OLD | NEW |
1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
4 | 4 |
5 package mutate | 5 package mutate |
6 | 6 |
7 import ( | 7 import ( |
8 "fmt" | 8 "fmt" |
9 "time" | 9 "time" |
10 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 if err != nil { | 80 if err != nil { |
81 logging.Fields{ | 81 logging.Fields{ |
82 logging.ErrorKey: err, | 82 logging.ErrorKey: err, |
83 "cfgName": e.DistributorConfigName, | 83 "cfgName": e.DistributorConfigName, |
84 }.Errorf(c, "Could not MakeDistributor") | 84 }.Errorf(c, "Could not MakeDistributor") |
85 return | 85 return |
86 } | 86 } |
87 var realRslt *dm.Result | 87 var realRslt *dm.Result |
88 q := model.QuestFromID(t.For.Quest) | 88 q := model.QuestFromID(t.For.Quest) |
89 if err = ds.Get(ds.WithoutTransaction(c), q); err != nil { | 89 if err = ds.Get(ds.WithoutTransaction(c), q); err != nil { |
90 » » » err = errors.Annotate(err).Reason("loading quest").Err() | 90 » » » err = errors.Annotate(err, "loading quest").Err() |
91 return | 91 return |
92 } | 92 } |
93 realRslt, err = dist.GetStatus(&q.Desc, distributor.Token(e.Dist
ributorToken)) | 93 realRslt, err = dist.GetStatus(&q.Desc, distributor.Token(e.Dist
ributorToken)) |
94 if (err != nil || realRslt == nil) && t.TimeoutAttempt < maxTime
outAttempts { | 94 if (err != nil || realRslt == nil) && t.TimeoutAttempt < maxTime
outAttempts { |
95 logging.Fields{ | 95 logging.Fields{ |
96 logging.ErrorKey: err, | 96 logging.ErrorKey: err, |
97 "task_result": realRslt, | 97 "task_result": realRslt, |
98 "timeout_attempt": t.TimeoutAttempt, | 98 "timeout_attempt": t.TimeoutAttempt, |
99 }.Infof(c, "GetStatus failed/nop'd while timing out STOP
PING execution") | 99 }.Infof(c, "GetStatus failed/nop'd while timing out STOP
PING execution") |
100 // TODO(riannucci): do randomized exponential backoff in
stead of constant | 100 // TODO(riannucci): do randomized exponential backoff in
stead of constant |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 return tumble.CancelNamedMutations(c, key, "timeout") | 147 return tumble.CancelNamedMutations(c, key, "timeout") |
148 } | 148 } |
149 return tumble.PutNamedMutations(c, key, map[string]tumble.Mutation{ | 149 return tumble.PutNamedMutations(c, key, map[string]tumble.Mutation{ |
150 "timeout": &TimeoutExecution{eid, e.State, 0, clock.Now(c).UTC()
.Add(howLong)}, | 150 "timeout": &TimeoutExecution{eid, e.State, 0, clock.Now(c).UTC()
.Add(howLong)}, |
151 }) | 151 }) |
152 } | 152 } |
153 | 153 |
154 func init() { | 154 func init() { |
155 tumble.Register((*TimeoutExecution)(nil)) | 155 tumble.Register((*TimeoutExecution)(nil)) |
156 } | 156 } |
OLD | NEW |