3 ms·
As the author of a http library (lua-http https://github.com/daurnimator/lua-http https://github.com/daurnimator/lua-http) that doesn't, I'm interested in how y
by daurnimator 10y ago
As the author of a http library (lua-http https://github.com/daurnimator/lua-http https://github.com/daurnimator/lua-http) that doesn't, I'm interested in how you'd want retries (not to mention exponential backoffs) to work:
- Should they be the default?
- What requests should be retried? (as much as we wish GETs were idempotent... they're not) see https://lists.w3.org/Archives/Public/ietf-http-wg/2017JanMar/0194.html https://lists.w3.org/Archives/Public/ietf-http-wg/2017JanMar... for an intro to the complexities here
- What should get reused? (e.g. do new dns lookup? reuse connection? reuse proxy connection?)
- How to handle non-replayable pieces? (e.g. request bodys coming from a fifo)
- Usually a request has a timeout/deadline. should it be restarted for the retry? (probably not)
I haven't implemented retries yet, as the above questions seem hard to answer without knowing application/server specific qualities (and hence should be left to the user of the http library). Please feel free to file an issue :)
- nebiyu 10y agoThat list of questions is why I prefer retry and back-off to be separate from the internals of the http library. As a library user I need to work around the peculiarities of the particular service endpoints I'm integrating with. Backoff and retry aren't specific to the application/transport protocol through which a service is consumed. For example, (in the java world) the approach in libraries like hysterix, guava-retrying, and failsafe https://github.com/jhalterman/failsafe#retries https://github.com/jhalterman/failsafe#retries
- Hydraulix989 10y agoWhat do you recommend for JS?
- nebiyu 10y agoLibraries that provide similar abstractions in js do exist (https://github.com/tim-kos/node-retry https://github.com/tim-kos/node-retry and https://github.com/MathieuTurcotte/node-backoff https://github.com/MathieuTurcotte/node-backoff), but I'm not qualified to recommend anything. Most of the colleagues I've had have rolled their own one off solutions when needed.