Drain rabbitmq consumers slowly from Cannon#4342
Merged
Conversation
2f95a06 to
9d7abe5
Compare
mdimjasevic
reviewed
Nov 19, 2024
mdimjasevic
approved these changes
Nov 19, 2024
Comment on lines
+110
to
+112
| mkEnv external o cs l d conns p g t rabbitmqOpts = | ||
| Env o l d conns (RequestId defRequestId) $ | ||
| WS.env external (o ^. cannon . port) (encodeUtf8 $ o ^. gundeck . host) (o ^. gundeck . port) l p d conns g t (o ^. drainOpts) rabbitmqOpts cs |
Contributor
There was a problem hiding this comment.
Maybe it's time to start using a record as a replacement to all these arguments to mkEnv. The same goes with arguments to WS.env.
mdimjasevic
reviewed
Nov 19, 2024
Comment on lines
+61
to
+62
| Q.closeConnection conn | ||
| void $ D.remove key e.rabbitConnections |
Contributor
There was a problem hiding this comment.
What happens if Cannon crashes in between these two?
Contributor
Author
There was a problem hiding this comment.
If it completely crashes, then there's no issue, it's not like the in-memory data will be preserved. Since this is bookkeeping for the graceful termination. If it starts graceful termination between these two steps, the worst case is trying to close a connection twice, which should be a no-op.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://wearezeta.atlassian.net/browse/WPB-11458
In case Cannon gets terminated, we want to drain the consumers, like we do with websocket queues.
Checklist
changelog.d