juju/retry take 2 - looping

Katherine Cox-Buday katherine.cox-buday at canonical.com
Thu Oct 20 15:30:19 UTC 2016


John Meinel <john at arbash-meinel.com> writes:

> As commented on the pull request, passing 'err' into Next() initially feels weird, but
> it allows a big improvement to whether the loop exited because we ran out of
> retries, or it exited because the request succeeded. (loop.Error()
> tells us either way.)

I don't understand why the retry logic has the concern of why the loop exits (i.e. Next(error)).

The motivation of moving towards loops was so that the concern of what's being retried is brought back to be inline with the surrounding code. Having the retry mechanism inspecting errors doesn't fall in line with that goal.

In my mind, any retry solutions only needs to cover two things:
1. Provide a primitive that will delay a for iteration in a controlled way.
2. Be preemptable.

Everything else is the logic of the thing you're retrying, including why it eventually succeeded/failed.

-- 
Katherine



More information about the Juju-dev mailing list