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

Unified Diff: appengine/cmd/dm/mutate/finish_attempt.go

Issue 1537883002: Initial distributor implementation (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: fix imports and make dummy.go a real file Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: appengine/cmd/dm/mutate/finish_attempt.go
diff --git a/appengine/cmd/dm/mutate/finish_attempt.go b/appengine/cmd/dm/mutate/finish_attempt.go
index 67bfb9ac5cf051b942e5ef417f3de83b2aeac600..9961b59628088cffbac055b05dc4cc9c10428b79 100644
--- a/appengine/cmd/dm/mutate/finish_attempt.go
+++ b/appengine/cmd/dm/mutate/finish_attempt.go
@@ -30,7 +30,7 @@ type FinishAttempt struct {
// Root implements tumble.Mutation
func (f *FinishAttempt) Root(c context.Context) *datastore.Key {
- return datastore.Get(c).KeyForObj(&model.Attempt{ID: *f.Auth.Id.AttemptID()})
+ return model.AttemptKeyFromID(c, f.Auth.Id.AttemptID())
}
// RollForward implements tumble.Mutation
@@ -38,16 +38,16 @@ func (f *FinishAttempt) Root(c context.Context) *datastore.Key {
// This mutation is called directly from FinishAttempt, so we use
// grpcutil.MaybeLogErr
func (f *FinishAttempt) RollForward(c context.Context) (muts []tumble.Mutation, err error) {
- atmpt, _, err := model.InvalidateExecution(c, f.Auth)
+ atmpt, ex, err := model.InvalidateExecution(c, f.Auth)
if err != nil {
return
}
- ds := datastore.Get(c)
+ if err = ResetExecutionTimeout(c, ex); err != nil {
+ return
+ }
- // Executing -> Finished is valid, and we know we're already Executing because
- // the InvalidateExecution call above asserts that or errors out.
- atmpt.MustModifyState(c, dm.Attempt_FINISHED)
+ ds := datastore.Get(c)
atmpt.ResultSize = uint32(len(f.Result))
atmpt.ResultExpiration = f.ResultExpiration
@@ -59,11 +59,7 @@ func (f *FinishAttempt) RollForward(c context.Context) (muts []tumble.Mutation,
}
err = grpcutil.MaybeLogErr(c, ds.Put(atmpt, rslt),
- codes.Internal, "while trying to PutMulti")
-
- // TODO(iannucci): also include mutations to generate index entries for
- // the attempt results.
- muts = append(muts, &RecordCompletion{For: f.Auth.Id.AttemptID()})
+ codes.Internal, "while trying to Put")
return
}
« no previous file with comments | « appengine/cmd/dm/mutate/ensure_quest_attempts_test.go ('k') | appengine/cmd/dm/mutate/finish_attempt_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698