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

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

Issue 1605363002: common/prpc, tools/cmd/cproto: prpc client (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: rebased and addressed comments 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
« no previous file with comments | « common/retry/limited.go ('k') | server/prpc/auth.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 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 11 matching lines...) Expand all
22 func (i *transientOnlyIterator) Next(ctx context.Context, err error) time.Durati on { 22 func (i *transientOnlyIterator) Next(ctx context.Context, err error) time.Durati on {
23 if !errors.IsTransient(err) { 23 if !errors.IsTransient(err) {
24 return Stop 24 return Stop
25 } 25 }
26 return i.Iterator.Next(ctx, err) 26 return i.Iterator.Next(ctx, err)
27 } 27 }
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 // Returns nil if f is nil.
32 func TransientOnly(f Factory) Factory { 33 func TransientOnly(f Factory) Factory {
34 if f == nil {
35 return nil
36 }
33 return wrap(f, func(it Iterator) Iterator { 37 return wrap(f, func(it Iterator) Iterator {
34 return &transientOnlyIterator{it} 38 return &transientOnlyIterator{it}
35 }) 39 })
36 } 40 }
OLDNEW
« no previous file with comments | « common/retry/limited.go ('k') | server/prpc/auth.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698