re-frame-http-fx-alpha icon indicating copy to clipboard operation
re-frame-http-fx-alpha copied to clipboard

Support exponential backoff

Open danielcompton opened this issue 5 years ago • 1 comments

Is it possible to retry errors using an exponential backoff with this library? I couldn't see a place to tell re-frame-http-fx-2 to wait n ms before reissuing the query, but maybe I'm missing something.

danielcompton avatar Aug 13 '19 23:08 danielcompton

Firstly, this library has gone through several iterations and will likely go through more. Its very much subject to changes as its a more an experiment than anything else. So this is important feedback and discussions to have at this point.

The original intent has always been, let the library user decide and implement their own state handling logic. In other words, their own problem handling strategy, their own retry logic, exponential backoff or not etc. The library just provides a scaffolding on which to make those application-specific decisions.

In the current iteration the :in-problem state handler triggers any re-tries by returning the fx {:http {:trigger :retry :request-id request-id}.

Since the user writes the :in-problem handler, normal re-frame mechanisms for delays (dispatch-ms) can be used but it is a bit inconvenient as another event handler to return the fx would need to be provided.

In a previous iteration, re-tries used to be just dispatches instead of fx return values so it was more convenient to use dispatch-ms.

In any case, where this question of retries goes next largely depends on other major open design questions about the library such as if we will use the current http-focused fsm model at all or bake a more refined general concept of the same into re-frame proper.

superstructor avatar Oct 18 '19 04:10 superstructor