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

Side by Side Diff: common/retry/transient.go

Issue 1610993002: LogDog: Add collector service implementation. (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: Created 4 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
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 retry 5 package retry
6 6
7 import ( 7 import (
8 "time" 8 "time"
9 9
10 "github.com/luci/luci-go/common/errors" 10 "github.com/luci/luci-go/common/errors"
(...skipping 17 matching lines...) Expand all
28 28
29 // TransientOnly returns an Iterator that wraps another Iterator. It will fall 29 // TransientOnly returns an Iterator that wraps another Iterator. It will fall
30 // through to the wrapped Iterator if a transient error is encountered; 30 // through to the wrapped Iterator if a transient error is encountered;
31 // otherwise, it will not retry. 31 // otherwise, it will not retry.
32 func TransientOnly(i Iterator) Iterator { 32 func TransientOnly(i Iterator) Iterator {
33 if i == nil { 33 if i == nil {
34 return nil 34 return nil
35 } 35 }
36 return &transientOnlyIterator{i} 36 return &transientOnlyIterator{i}
37 } 37 }
38
39 // TransientOnlyGenerator wraps a retry.Generator, retrying only in the event
40 // of Transient errors.
41 func TransientOnlyGenerator(gen Generator) Generator {
dnj (Google) 2016/01/21 04:36:24 Now that we have the concept of a generator, we ca
42 return func() Iterator {
43 return TransientOnly(gen())
44 }
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698