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

Side by Side Diff: tumble/fire_tasks.go

Issue 2617043005: Use batch add for Tumble task queue tasks. (Closed)
Patch Set: Created 3 years, 11 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 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 tumble 5 package tumble
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "math" 9 "math"
10 "time" 10 "time"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 Path: processURL(eta, shard.shard), 71 Path: processURL(eta, shard.shard),
72 72
73 ETA: eta.Unix(), 73 ETA: eta.Unix(),
74 74
75 // TODO(riannucci): Tune RetryOptions? 75 // TODO(riannucci): Tune RetryOptions?
76 } 76 }
77 tasks = append(tasks, tsk) 77 tasks = append(tasks, tsk)
78 logging.Infof(c, "added task %q %s %s", tsk.Name, tsk.Path, tsk. ETA) 78 logging.Infof(c, "added task %q %s %s", tsk.Name, tsk.Path, tsk. ETA)
79 } 79 }
80 80
81 » if err := errors.Filter(tq.Add(ds.WithoutTransaction(c), baseName, tasks ...), tq.ErrTaskAlreadyAdded); err != nil { 81 » b := tq.Batcher{}
82 » if err := errors.Filter(b.Add(ds.WithoutTransaction(c), baseName, tasks. ..), tq.ErrTaskAlreadyAdded); err != nil {
82 logging.Warningf(c, "attempted to fire tasks %v, but failed: %s" , shards, err) 83 logging.Warningf(c, "attempted to fire tasks %v, but failed: %s" , shards, err)
83 return false 84 return false
84 } 85 }
85 return true 86 return true
86 } 87 }
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