| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. | 1 // Copyright 2015 The LUCI Authors. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 wg := sync.WaitGroup{} | 46 wg := sync.WaitGroup{} |
| 47 wg.Add(1) | 47 wg.Add(1) |
| 48 go func() { | 48 go func() { |
| 49 defer wg.Done() | 49 defer wg.Done() |
| 50 inv, err1 = eng.GetInvocation(c.Context, projectID+"/"+jobName,
invID) | 50 inv, err1 = eng.GetInvocation(c.Context, projectID+"/"+jobName,
invID) |
| 51 }() | 51 }() |
| 52 wg.Add(1) | 52 wg.Add(1) |
| 53 go func() { | 53 go func() { |
| 54 defer wg.Done() | 54 defer wg.Done() |
| 55 » » job, err2 = eng.GetJob(c.Context, projectID+"/"+jobName) | 55 » » job, err2 = eng.GetJobRA(c.Context, projectID+"/"+jobName) |
| 56 }() | 56 }() |
| 57 wg.Wait() | 57 wg.Wait() |
| 58 | 58 |
| 59 // panic on internal datastore errors to trigger HTTP 500. | 59 // panic on internal datastore errors to trigger HTTP 500. |
| 60 switch { | 60 switch { |
| 61 case err1 != nil: | 61 case err1 != nil: |
| 62 panic(err1) | 62 panic(err1) |
| 63 case err2 != nil: | 63 case err2 != nil: |
| 64 panic(err2) | 64 panic(err2) |
| 65 case inv == nil: | 65 case inv == nil: |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 invIDAsInt, err := strconv.ParseInt(invID, 10, 64) | 98 invIDAsInt, err := strconv.ParseInt(invID, 10, 64) |
| 99 if err != nil { | 99 if err != nil { |
| 100 http.Error(c.Writer, "Bad invocation ID", 400) | 100 http.Error(c.Writer, "Bad invocation ID", 400) |
| 101 return | 101 return |
| 102 } | 102 } |
| 103 if err := cb(projectID+"/"+jobName, invIDAsInt); err != nil { | 103 if err := cb(projectID+"/"+jobName, invIDAsInt); err != nil { |
| 104 panic(err) | 104 panic(err) |
| 105 } | 105 } |
| 106 http.Redirect(c.Writer, c.Request, fmt.Sprintf("/jobs/%s/%s/%s", project
ID, jobName, invID), http.StatusFound) | 106 http.Redirect(c.Writer, c.Request, fmt.Sprintf("/jobs/%s/%s/%s", project
ID, jobName, invID), http.StatusFound) |
| 107 } | 107 } |
| OLD | NEW |