OLD | NEW |
1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 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 ds "github.com/luci/gae/service/datastore" | 8 ds "github.com/luci/gae/service/datastore" |
9 "github.com/luci/luci-go/common/data/bit_field" | 9 "github.com/luci/luci-go/common/data/bit_field" |
10 "github.com/luci/luci-go/common/errors" | 10 "github.com/luci/luci-go/common/errors" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 if err != nil { | 44 if err != nil { |
45 return | 45 return |
46 } | 46 } |
47 | 47 |
48 if err = ResetExecutionTimeout(c, ex); err != nil { | 48 if err = ResetExecutionTimeout(c, ex); err != nil { |
49 logging.WithError(err).Errorf(c, "could not reset timeout") | 49 logging.WithError(err).Errorf(c, "could not reset timeout") |
50 return | 50 return |
51 } | 51 } |
52 | 52 |
53 fwdDeps, err := filterExisting(c, model.FwdDepsFromList(c, a.Auth.Id.Att
emptID(), a.Deps)) | 53 fwdDeps, err := filterExisting(c, model.FwdDepsFromList(c, a.Auth.Id.Att
emptID(), a.Deps)) |
54 » err = errors.Annotate(err).Tag(grpcutil.Tag.With(codes.Internal)). | 54 » err = errors.Annotate(err, "while filtering deps").Tag(grpcutil.Tag.With
(codes.Internal)).Err() |
55 » » Reason("while filtering deps").Err() | |
56 if err != nil || len(fwdDeps) == 0 { | 55 if err != nil || len(fwdDeps) == 0 { |
57 return | 56 return |
58 } | 57 } |
59 | 58 |
60 logging.Fields{"aid": atmpt.ID, "count": len(fwdDeps)}.Infof(c, "added d
eps") | 59 logging.Fields{"aid": atmpt.ID, "count": len(fwdDeps)}.Infof(c, "added d
eps") |
61 atmpt.DepMap = bit_field.Make(uint32(len(fwdDeps))) | 60 atmpt.DepMap = bit_field.Make(uint32(len(fwdDeps))) |
62 | 61 |
63 for i, fdp := range fwdDeps { | 62 for i, fdp := range fwdDeps { |
64 fdp.BitIndex = uint32(i) | 63 fdp.BitIndex = uint32(i) |
65 fdp.ForExecution = atmpt.CurExecution | 64 fdp.ForExecution = atmpt.CurExecution |
66 } | 65 } |
67 | 66 |
68 if err = ds.Put(c, fwdDeps, atmpt, ex); err != nil { | 67 if err = ds.Put(c, fwdDeps, atmpt, ex); err != nil { |
69 » » err = errors.Annotate(err).Tag(grpcutil.Tag.With(codes.Internal)
). | 68 » » err = errors.Annotate(err, "putting stuff").Tag(grpcutil.Tag.Wit
h(codes.Internal)).Err() |
70 » » » Reason("putting stuff").Err() | |
71 return | 69 return |
72 } | 70 } |
73 | 71 |
74 mergeQuestMap := map[string]*MergeQuest(nil) | 72 mergeQuestMap := map[string]*MergeQuest(nil) |
75 if len(a.Quests) > 0 { | 73 if len(a.Quests) > 0 { |
76 mergeQuestMap = make(map[string]*MergeQuest, len(a.Quests)) | 74 mergeQuestMap = make(map[string]*MergeQuest, len(a.Quests)) |
77 for _, q := range a.Quests { | 75 for _, q := range a.Quests { |
78 mergeQuestMap[q.ID] = &MergeQuest{Quest: q} | 76 mergeQuestMap[q.ID] = &MergeQuest{Quest: q} |
79 } | 77 } |
80 } | 78 } |
(...skipping 25 matching lines...) Expand all Loading... |
106 for _, mut := range mergeQuestMap { | 104 for _, mut := range mergeQuestMap { |
107 muts = append(muts, mut) | 105 muts = append(muts, mut) |
108 } | 106 } |
109 | 107 |
110 return | 108 return |
111 } | 109 } |
112 | 110 |
113 func init() { | 111 func init() { |
114 tumble.Register((*AddDeps)(nil)) | 112 tumble.Register((*AddDeps)(nil)) |
115 } | 113 } |
OLD | NEW |