Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Add the ability to specify MaxDuration instead of Attempts. #2
Conversation
howbazaar
added some commits
Oct 27, 2015
mjs
reviewed
Oct 28, 2015
| @@ -222,6 +204,13 @@ type CallArgs struct { | ||
| // value is specified there is no maximum delay. | ||
| MaxDelay time.Duration | ||
| + // MaxWait specifies the maximum time the Call function should wait. The | ||
| + // wait time is the summation of the delays over the attempts. If the next |
mjs
reviewed
Oct 28, 2015
| + // delay time would take the total waiting duration over MaxWait, then an | ||
| + // WaitTimeExceeded error is returned. If no value is specified, Call will | ||
| + // continue until the number of attempts is complete. | ||
| + MaxWait time.Duration |
mjs
Oct 28, 2015
The concept of MaxWait seems a little strange to me. If I understand it correctly it's compared against the total time spent waiting in between attempts. This seems like a counter-intuitive parameter.
What about having MaxDuration? Where the caller can set the maximum time the whole process can take (including the time taken to call Func etc).
howbazaar
added some commits
Oct 29, 2015
howbazaar
changed the title from
Add the ability to specify MaxWait instead of Attempts.
to
Add the ability to specify MaxDuration instead of Attempts.
Oct 29, 2015
mjs
reviewed
Oct 29, 2015
| -func (*mockClock) Now() time.Time { | ||
| - return time.Now() | ||
| +func (mock *mockClock) Now() time.Time { | ||
| + if mock.now.IsZero() { |
mjs
commented
Oct 29, 2015
|
LGTM! |
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju-retry |
added a commit
that referenced
this pull request
Oct 29, 2015
jujubot
merged commit 62c6203
into
juju:master
Oct 29, 2015
howbazaar
deleted the
howbazaar:max-wait
branch
Oct 29, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
howbazaar commentedOct 27, 2015
During the initial work to add to juju/juju, it became apparent that being able to specify a MaxDuration rather than an Attempt count is desirable.