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

Side by Side Diff: milo/appengine/buildbot/pubsub.go

Issue 2421713003: Milo: Pubsub - Trim out pending build states if there are more than 25 per builder (Closed)
Patch Set: Created 4 years, 2 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 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 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 buildbot 5 package buildbot
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "compress/gzip" 9 "compress/gzip"
10 "compress/zlib" 10 "compress/zlib"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // Internal 68 // Internal
69 Internal bool 69 Internal bool
70 // Data is the json serialzed and gzipped blob of the master data. 70 // Data is the json serialzed and gzipped blob of the master data.
71 Data []byte `gae:",noindex"` 71 Data []byte `gae:",noindex"`
72 // Modified is when this entry was last modified. 72 // Modified is when this entry was last modified.
73 Modified time.Time 73 Modified time.Time
74 } 74 }
75 75
76 func putDSMasterJSON( 76 func putDSMasterJSON(
77 c context.Context, master *buildbotMaster, internal bool) error { 77 c context.Context, master *buildbotMaster, internal bool) error {
78 // Trim pending build states. These things are large and we can't reall y
estaab 2016/10/19 22:09:35 How can we inform consumers that this was trimmed?
hinoka 2016/10/19 22:23:11 We send both the total number of pending builds (i
79 // store more than 25 of them. If this becomes an issue again, we'll ha ve
80 // to trim out things from the pending build state such as the changed
81 // file list, commit comments, etc.
82 for _, builder := range master.Builders {
83 if len(builder.PendingBuildStates) > 25 {
84 builder.PendingBuildStates = builder.PendingBuildStates[ 0:25]
85 }
86 }
78 entry := buildbotMasterEntry{ 87 entry := buildbotMasterEntry{
79 Name: master.Name, 88 Name: master.Name,
80 Internal: internal, 89 Internal: internal,
81 Modified: clock.Now(c).UTC(), 90 Modified: clock.Now(c).UTC(),
82 } 91 }
83 gzbs := bytes.Buffer{} 92 gzbs := bytes.Buffer{}
84 gsw := gzip.NewWriter(&gzbs) 93 gsw := gzip.NewWriter(&gzbs)
85 cw := iotools.CountingWriter{Writer: gsw} 94 cw := iotools.CountingWriter{Writer: gsw}
86 e := json.NewEncoder(&cw) 95 e := json.NewEncoder(&cw)
87 if err := e.Encode(master); err != nil { 96 if err := e.Encode(master); err != nil {
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 if err != nil { 303 if err != nil {
295 logging.WithError(err).Errorf( 304 logging.WithError(err).Errorf(
296 c, "Could not save master in datastore %s", err) 305 c, "Could not save master in datastore %s", err)
297 // This is transient, we do want PubSub to retry. 306 // This is transient, we do want PubSub to retry.
298 h.WriteHeader(500) 307 h.WriteHeader(500)
299 return 308 return
300 } 309 }
301 } 310 }
302 h.WriteHeader(200) 311 h.WriteHeader(200)
303 } 312 }
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