fastify / fastify-reply-from

fastify plugin to forward the current http request to another server
MIT License
148 stars 76 forks source link

add: retriesCount property to the callback #344

Closed MikePresman closed 8 months ago

MikePresman commented 8 months ago

Initially the custom retry handler was put in place to give the client true freedom of handling retries. I quickly saw this comes at a cost of making the simple mistake (which I had done !) of infinitely retrying.

Now there are two approaches to this. 1) Respect the underlying spirit of custom retries and having the client handle the retries (which is what this PR is proposing by passing back the retriesCount). 2) Limiting it on the library and not the client level with a conditional.

I have no belief that one is greater than the other but would like to respect the spirit of the initial PR.

So whats the point of this PR at all. To avoid hardcoding and passing values. This is simply cleaner.

Checklist