Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Side by Side Diff: dm/appengine/mutate/timeout_execution.go

Issue 2963503003: [errors] Greatly simplify common/errors package. (Closed)
Patch Set: fix nits Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « dm/appengine/mutate/finish_attempt.go ('k') | dm/tools/dmtool/vizQuery.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « dm/appengine/mutate/finish_attempt.go ('k') | dm/tools/dmtool/vizQuery.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698