http-client icon indicating copy to clipboard operation
http-client copied to clipboard

Allow Retries for Write Operations

Open joshmgross opened this issue 5 years ago • 2 comments

The allowRetries option currently only applies OPTIONS, GET, DELETE and HEAD (see RetryableHttpVerbs since those operations are idempotent by default. This is a good default and avoids any unintended side effects.

There should be an option for the client to specify allowing retries for specific write operations (PUT and POST) if the client knows they are idempotent.

joshmgross avatar Jan 10 '20 23:01 joshmgross

@joshmgross - since this is so specific to the caller, scenario, and potentially a dangerous thing to do, I think it's best for the consumer to do the retries. Either that or the option is allow unsafeWriteRetries? (sort of how a compiler makes unsafe optional stuff clear). Thoughts?

bryanmacfarlane avatar Apr 10 '20 14:04 bryanmacfarlane

I think an unsafeWriteRetries option would work, as it clarifies that it's potentially dangerous. Making the consumer implement their own retries is fine, but ends up just duplicating code that's already contained in this package and could potentially introduce issues if not implemented correctly.

joshmgross avatar Apr 10 '20 15:04 joshmgross