Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idempotent request stratgey is per-client, not per-request #520

Open
WesleyAC opened this issue Mar 19, 2024 · 1 comment
Open

Idempotent request stratgey is per-client, not per-request #520

WesleyAC opened this issue Mar 19, 2024 · 1 comment

Comments

@WesleyAC
Copy link

Is your feature request related to a problem? Please describe.

It's strange to me that the RequestStrategy is set on a per-client basis, rather than a per-request basis. If I'm interpreting this correctly, this means that the only way to make multiple idempotent requests with different keys is to create a new client for each request. Is this the correct way to use this library?

Describe the solution you'd like

A way to set the idempotency key per-request with the same client

Describe alternatives you've considered

Better documentation of this feature, in the case that creating a fresh client is low-cost and the correct way to do this.

Additional context

No response

@arlyon
Copy link
Owner

arlyon commented Apr 4, 2024

The client is cheap to clone so yes that is the intended strategy if you cannot use the exponential back off which handles the token for you per request. We are considering a new API for this in the impending rewrite (currently on the next branch) so that this is clearer since people (rightfully) get paranoid cloning things.

In the meantime time I will open a quick PR that explains this.

jwiesler added a commit that referenced this issue Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants