You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: