-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add method to restart stream when retry strategy is exhausted #88
Conversation
Signed-off-by: Mathias L. Baumann <mathias.baumann@frequenz.com>
Do we really need this? Why not just setting the retry
|
I am setting it to None. But how I am ever gonna restart that stream now? |
This comment was marked as outdated.
This comment was marked as outdated.
Why do you want to restart it if it restarts automatically continuously. Maybe you can describe the use case you have in mind more in detail?
Yes, indefinitely. frequenz-client-base-python/src/frequenz/client/base/streaming.py Lines 50 to 52 in dfdfaf3
frequenz-client-base-python/src/frequenz/client/base/retry.py Lines 77 to 84 in dfdfaf3
|
Well, I want an exception to be thrown when the connection fails. Then I handle it etc.. and then I want to try it again. But i can't, when the retry strategy is exhausted, the whole streamer instance is from that point on useless. |
No, why? It says it retries indefinitely.
So you don't want to retry indefinitely, you want to have more control, is that the use case? |
Yes, that's the usecase. Remember, we wanted to put the handling a level higher? |
OK, I guess I was confused by the PR title, because in this case you don't want a retry strategy at all, right? |
Yes. but I can have that already when I just say "limit=0". |
OK, looking at it again with the new information, what would be the advantage of being able to restart it compared to create a new streamer? You are rebuilding the whole internal state (recreating the channel, tasks, etc.), so from the efficiency point of view I guess it doesn't make a lot of difference. For your use case it would be more inconvenient to re-create the streamer instead? In any this PR is fixing a sort of bug, it is not great that if you call But I was wondering if we could still keep the channel opened (or even the task alive). As for the channel, right now it is closed to stop the receivers, I think, so I wonder if this is something we want to do or not. |
Oh, I guess in your use case you'll just create a new receiver for the streamer when the current receiver stops? If so I can see how it is simpler to use than recreating the whole streamer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would update the PR description and commit message to something like "Allow (re)starting a stopped streamer" to make it less confusing, other than that I'm fine with merging this as is and leave other ideas for future improvements.
I mean, i can also recreate the whole instance, sure frequenz-floss/frequenz-client-dispatch-python#94 |
I'm also fine with both, I wanted to understand the use case better. Both PRs are approved, I leave it to you to chose what to use. |
No description provided.