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

Side by Side Diff: go/src/infra/appengine/test-results/frontend/upload.go

Issue 2355353002: Return 409 error when uploading build with same number again (Closed)
Patch Set: Fix Created 4 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 | go/src/infra/appengine/test-results/frontend/upload_test.go » ('j') | 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 Chromium Authors. All rights reserved. 1 // Copyright 2016 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 frontend 5 package frontend
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "encoding/json" 9 "encoding/json"
10 "errors" 10 "errors"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 return statusError{err, http.StatusInternalServerError} 272 return statusError{err, http.StatusInternalServerError}
273 } 273 }
274 274
275 incr, err := f.AggregateResult() 275 incr, err := f.AggregateResult()
276 if err != nil { 276 if err != nil {
277 logging.WithError(err).Errorf(c, "updateFullResults: convert to AggregateResult") 277 logging.WithError(err).Errorf(c, "updateFullResults: convert to AggregateResult")
278 return statusError{err, http.StatusBadRequest} 278 return statusError{err, http.StatusBadRequest}
279 } 279 }
280 if err := updateIncremental(c, &incr); err != nil { 280 if err := updateIncremental(c, &incr); err != nil {
281 logging.WithError(err).Errorf(c, "updateFullResults: updateIncre mental") 281 logging.WithError(err).Errorf(c, "updateFullResults: updateIncre mental")
282 » » return statusError{err, http.StatusInternalServerError} 282 » » code := http.StatusInternalServerError
283 » » if se, ok := err.(statusError); ok {
284 » » » code = se.code
285 » » }
286 » » return statusError{err, code}
283 } 287 }
284 288
285 p := GetUploadParams(c) 289 p := GetUploadParams(c)
286 wg := sync.WaitGroup{} 290 wg := sync.WaitGroup{}
287 291
288 wg.Add(1) 292 wg.Add(1)
289 go func() { 293 go func() {
290 defer wg.Done() 294 defer wg.Done()
291 if err := builderstate.Update(c, p.Master, p.Builder, p.TestType , time.Now().UTC()); err != nil { 295 if err := builderstate.Update(c, p.Master, p.Builder, p.TestType , time.Now().UTC()); err != nil {
292 // This isn't a fatal error; log at something less atten tion-seeking. 296 // This isn't a fatal error; log at something less atten tion-seeking.
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 }.Infof(c, "deleteKeys: enqueing") 565 }.Infof(c, "deleteKeys: enqueing")
562 566
563 return taskqueue.Add(c, deleteKeysQueueName, &taskqueue.Task{ 567 return taskqueue.Add(c, deleteKeysQueueName, &taskqueue.Task{
564 Path: deleteKeysPath, 568 Path: deleteKeysPath,
565 Payload: payload, 569 Payload: payload,
566 Header: h, 570 Header: h,
567 Method: "POST", 571 Method: "POST",
568 Delay: time.Duration(30) * time.Minute, 572 Delay: time.Duration(30) * time.Minute,
569 }) 573 })
570 } 574 }
OLDNEW
« no previous file with comments | « no previous file | go/src/infra/appengine/test-results/frontend/upload_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698