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

Side by Side Diff: appengine/cmd/cron/engine/engine.go

Issue 1359813004: Use new StringID function. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: Created 5 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Package engine implements the core logic of the cron service. 5 // Package engine implements the core logic of the cron service.
6 package engine 6 package engine
7 7
8 import ( 8 import (
9 "bytes" 9 "bytes"
10 "encoding/json" 10 "encoding/json"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 q := datastore.NewQuery("CronJob").Eq("Enabled", true) 208 q := datastore.NewQuery("CronJob").Eq("Enabled", true)
209 keys := []*datastore.Key{} 209 keys := []*datastore.Key{}
210 if err := ds.GetAll(q, &keys); err != nil { 210 if err := ds.GetAll(q, &keys); err != nil {
211 return errors.WrapTransient(err) 211 return errors.WrapTransient(err)
212 } 212 }
213 wg := sync.WaitGroup{} 213 wg := sync.WaitGroup{}
214 errs := errors.NewLazyMultiError(len(keys)) 214 errs := errors.NewLazyMultiError(len(keys))
215 for i, key := range keys { 215 for i, key := range keys {
216 wg.Add(1) 216 wg.Add(1)
217 go func(i int, key *datastore.Key) { 217 go func(i int, key *datastore.Key) {
218 » » » errs.Assign(i, e.resetJob(c, key.Last().StringID)) 218 » » » errs.Assign(i, e.resetJob(c, key.StringID()))
219 wg.Done() 219 wg.Done()
220 }(i, key) 220 }(i, key)
221 } 221 }
222 wg.Wait() 222 wg.Wait()
223 return errors.WrapTransient(errs.Get()) 223 return errors.WrapTransient(errs.Get())
224 } 224 }
225 225
226 // getProjectJobs fetches from datastore all enabled jobs belonging to a given 226 // getProjectJobs fetches from datastore all enabled jobs belonging to a given
227 // project. 227 // project.
228 func (e *engineImpl) getProjectJobs(c context.Context, projectID string) (map[st ring]*jobEntity, error) { 228 func (e *engineImpl) getProjectJobs(c context.Context, projectID string) (map[st ring]*jobEntity, error) {
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 return cb(c, jobID, invocationID) 556 return cb(c, jobID, invocationID)
557 } 557 }
558 return e.txn(c, jobID, func(c context.Context, job *jobEntity, isNew boo l) error { 558 return e.txn(c, jobID, func(c context.Context, job *jobEntity, isNew boo l) error {
559 if isNew { 559 if isNew {
560 logging.Errorf(c, "Running job is unexpectedly gone") 560 logging.Errorf(c, "Running job is unexpectedly gone")
561 return errSkipPut 561 return errSkipPut
562 } 562 }
563 return e.rollSM(c, job, func(sm *StateMachine) error { return sm .OnInvocationDone(invocationID) }) 563 return e.rollSM(c, job, func(sm *StateMachine) error { return sm .OnInvocationDone(invocationID) })
564 }) 564 })
565 } 565 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698