Re: Let's talk retries

2016-08-09 Thread Katherine Cox-Buday
roger peppe writes: > There's a fourth way that you haven't mentioned, which fits somewhere > in between 1 and 2 I think (it was the first explicit general retry > code in Juju AFAIK), which is utils.Attempt. > > I'd suggest that the way it's used matches the pattern

Re: Let's talk retries

2016-08-09 Thread Nate Finch
So, in my opinion, juju/retry is pretty good. I think with some tweaking and some intelligent use, it can feel every bit as lightweight as we'd like. If we have common use cases, we just need to write up an API to encapsulate them. If we want a "retry N times or until this channel is closed"

Re: Let's talk retries

2016-08-09 Thread Katherine Cox-Buday
Andrew's queue is certainly nice, but I agree with the points Roger is raising: 1. Go's idiom for coordinating concurrent operations are goroutines and channels. 2. Sticking to these idioms makes it much easier to compose parts into a whole (if only because the language strongly bends code that

Re: Let's talk retries

2016-08-09 Thread William Reade
On Tue, Aug 9, 2016 at 10:17 AM, roger peppe wrote: > BTW I'm not saying that a timer queue is never the correct answer. In some > circumstances, it can be the exactly the right thing to use. > Yeah -- the context here is that katco has been looking at the

Re: Let's talk retries

2016-08-09 Thread roger peppe
On 9 August 2016 at 07:28, roger peppe wrote: > On 9 August 2016 at 01:22, Katherine Cox-Buday > wrote: >> Hey All, >> >> We currently have 3 ways we're performing retries in Juju: >> >> 1. Archaic, custom, intra-package retry code.

Re: Let's talk retries

2016-08-09 Thread roger peppe
On 9 August 2016 at 01:22, Katherine Cox-Buday wrote: > Hey All, > > We currently have 3 ways we're performing retries in Juju: > > 1. Archaic, custom, intra-package retry code. > 2. github.com/juju/utils::{Countdown,BackoffTimer} > 3. github.com/juju/retry

Re: Let's talk retries

2016-08-08 Thread Menno Smits
On 9 August 2016 at 12:22, Katherine Cox-Buday < katherine.cox-bu...@canonical.com> wrote: > > To implement this, I do something like this: > > args := retry.CallArgs{ > Func: func() error { > // Body of my loop > }, > BackoffFunc: func(delay time.Duration, attempt int)

Let's talk retries

2016-08-08 Thread Katherine Cox-Buday
Hey All, We currently have 3 ways we're performing retries in Juju: 1. Archaic, custom, intra-package retry code. 2. github.com/juju/utils::{Countdown,BackoffTimer} 3. github.com/juju/retry (current best practice) I have just touched some code which fits #1, and when I was attempting to