Last active
May 17, 2016 13:13
-
-
Save gavrie/529fbeeabd2cd7b83c1aac07d6f47e63 to your computer and use it in GitHub Desktop.
Revisions
-
gavrie revised this gist
May 17, 2016 . 1 changed file with 1 addition and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,15 +10,4 @@ func NewBasic(timeout time.Duration, retries int) *basicRetrier { } br.virtual = br return br } -
gavrie revised this gist
May 17, 2016 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,10 @@ type basicRetrier struct { } func NewBasic(timeout time.Duration, retries int) *basicRetrier { br := &basicRetrier{ timeout: timeout, retries: retries, } br.virtual = br return br } -
gavrie created this gist
May 17, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ type basicRetrier struct { // ... virtual retrier } func NewBasic(timeout time.Duration, retries int) *basicRetrier { // ... br.virtual = br return br } func (br *basicRetrier) TotalTimeout() (total time.Duration) { r := *br // Make a copy to preserve unchanged original for r.virtual.keepTrying() { total += r.virtual.nextTimeout() } log.Printf("Total timeout: %v\n", total) return total }