-
This is (I hope) an overly simple question, but I'm adding this to a more complex setup that already has go routines to keep things running. What would be the correct way to do that here? I'd want something that is linked to a context (that will be shared with other routines), e.g. go wait.UntilWithContext(ctx, startRiver, 0)
<-ctx.Done()
# clean up / close stuff So my question would be - what should be in |
Beta Was this translation helpful? Give feedback.
Answered by
brandur
Jul 26, 2024
Replies: 1 comment 2 replies
-
Oh hmm looking at the bottom of Line 652 in bf61772 |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@vsoch Yep, all you need to do is to call
Client.Start
and the River client will run until one of the following conditions is met:Client.Stop
is called.Generally (2) is preferred because by using
Stop
you give the client a chance to gracefully try to finish up with any jobs it's currently working. Cancelling the context will cause a "hard stop" that'll throw out existing work.In your code above, you probably want to have a stopping signal that tries to stop gracefully before going full scorched earth and cancelling everything. e.g.