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

The stamina example is misleading #27

Open
catwell opened this issue Jan 29, 2025 · 0 comments
Open

The stamina example is misleading #27

catwell opened this issue Jan 29, 2025 · 0 comments

Comments

@catwell
Copy link

catwell commented Jan 29, 2025

The stamina retrying example from the README is a bit misleading.

The problem is libraries like stamina and tenacity expect the decorated function (or the code block in their context) to return, that is how they consider it successful. In the case of a SSE stream, the function never returns so it is never marked as successful. This means the state of the retry context will never retry. Retries will take more and more time and eventually it will fail despite the server being back in the meantime.

What we'd want is probably to reset the state when the source reconnects and/or after the first event received. I have a project where I need this and I couldn't figure out an easy way to do this with stamina or tenacity so I re-implemented the backoff logic manually here.

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

1 participant