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

Unified Diff: build_scheduler/go/db/modified_tasks.go

Issue 2246933002: Add Task DB implementation using a local BoltDB. (Closed) Base URL: https://skia.googlesource.com/buildbot@taskdb-impl-track
Patch Set: Created 4 years, 4 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: build_scheduler/go/db/modified_tasks.go
diff --git a/build_scheduler/go/db/modified_tasks.go b/build_scheduler/go/db/modified_tasks.go
index 7408481e591ff6da14a8d8e441ed3bfba459268a..0fde3e4d67996991dce98fe0ec7580b310d55ee7 100644
--- a/build_scheduler/go/db/modified_tasks.go
+++ b/build_scheduler/go/db/modified_tasks.go
@@ -61,12 +61,19 @@ func (m *ModifiedTasks) clearExpiredSubscribers() {
// TrackModifiedTask indicates the given Task should be returned from the next
// call to GetModifiedTasks from each subscriber.
func (m *ModifiedTasks) TrackModifiedTask(t *Task) {
+ m.TrackModifiedTasks([]*Task{t})
+}
+
+// TrackModifiedTasks calls TrackModifiedTask on each item.
+func (m *ModifiedTasks) TrackModifiedTasks(tasks []*Task) {
m.mtx.Lock()
defer m.mtx.Unlock()
- // Make a single copy, since GetModifiedTasks also copies.
- t = t.Copy()
- for _, modTasks := range m.tasks {
- modTasks[t.Id] = t
+ for _, t := range tasks {
+ // Make a single copy, since GetModifiedTasks also copies.
+ t = t.Copy()
+ for _, modTasks := range m.tasks {
+ modTasks[t.Id] = t
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698