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

stopRecieveUpdates method #149

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AlimByWater
Copy link

a method that allows you to stop receiving updates without completely stopping (without calling the Stop() method)

@negasus
Copy link
Contributor

negasus commented Jan 15, 2025

Can you give an example of the need for such functionality? How I can start getting updates manually after stop?

@AlimByWater
Copy link
Author

AlimByWater commented Jan 15, 2025

there is no way to start again, it requires additional functionality.
example:
Let's say I'm processing requests from users. it takes me >10 seconds to process one request. the StopReceiveUpdates() method allows me not to process new requests (leaving them in the updates queue), finish processing of current ones and send the result to the user. after that, you can restart the applications, for example, during the ci/cd process.

At the moment, if I call the Stop() method, then I will not be able to perform the last step, that is, send the result to the user.

@negasus
Copy link
Contributor

negasus commented Jan 15, 2025

But you can use context cancel.

It doing same, as your PR. Cancelling waitUpdates method

@AlimByWater
Copy link
Author

Yes, but it a little bit less conviniet, because if i use this context accross all modules of my app (for gracefull shutdown for example) then i need to wrap it exclusively for this Bot.

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

Successfully merging this pull request may close these issues.

2 participants