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 distributor | 5 package distributor |
6 | 6 |
7 import ( | 7 import ( |
8 ds "github.com/luci/gae/service/datastore" | 8 ds "github.com/luci/gae/service/datastore" |
9 "github.com/luci/luci-go/common/errors" | 9 "github.com/luci/luci-go/common/errors" |
10 "github.com/luci/luci-go/common/logging" | 10 "github.com/luci/luci-go/common/logging" |
(...skipping 22 matching lines...) Expand all Loading... |
33 if err != nil { | 33 if err != nil { |
34 logging.Fields{ | 34 logging.Fields{ |
35 logging.ErrorKey: err, | 35 logging.ErrorKey: err, |
36 "cfg": f.CfgName, | 36 "cfg": f.CfgName, |
37 }.Errorf(c, "Failed to make distributor") | 37 }.Errorf(c, "Failed to make distributor") |
38 return | 38 return |
39 } | 39 } |
40 | 40 |
41 q := &model.Quest{ID: f.Notification.ID.Quest} | 41 q := &model.Quest{ID: f.Notification.ID.Quest} |
42 if err := ds.Get(ds.WithoutTransaction(c), q); err != nil { | 42 if err := ds.Get(ds.WithoutTransaction(c), q); err != nil { |
43 » » return nil, errors.Annotate(err).Reason("getting Quest").Err() | 43 » » return nil, errors.Annotate(err, "getting Quest").Err() |
44 } | 44 } |
45 rslt, err := dist.HandleNotification(&q.Desc, f.Notification) | 45 rslt, err := dist.HandleNotification(&q.Desc, f.Notification) |
46 if err != nil { | 46 if err != nil { |
47 // TODO(riannucci): check for transient/non-transient | 47 // TODO(riannucci): check for transient/non-transient |
48 logging.Fields{ | 48 logging.Fields{ |
49 logging.ErrorKey: err, | 49 logging.ErrorKey: err, |
50 "cfg": f.CfgName, | 50 "cfg": f.CfgName, |
51 }.Errorf(c, "Failed to handle notification") | 51 }.Errorf(c, "Failed to handle notification") |
52 return | 52 return |
53 } | 53 } |
54 if rslt != nil { | 54 if rslt != nil { |
55 return reg.FinishExecution(c, f.Notification.ID, rslt) | 55 return reg.FinishExecution(c, f.Notification.ID, rslt) |
56 } | 56 } |
57 return | 57 return |
58 } | 58 } |
59 | 59 |
60 func init() { | 60 func init() { |
61 tumble.Register((*NotifyExecution)(nil)) | 61 tumble.Register((*NotifyExecution)(nil)) |
62 } | 62 } |
OLD | NEW |