Repository navigation
fix(discord): preserve gateway sessions during shutdown - #28
Merged
Merged
Conversation
Stopping closed the gateway connection with code 1000, which makes Discord invalidate the session. The replacement plugin then couldn't resume, so a message sent during a rollout couldn't be replayed. Close with 1012 instead, and test replay of a message received while disconnected. Ref: #27 Taariq Lewis, SerenAI, Paloma, and Volume at https://serendb.com Email: hello@serendb.com
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.
Summary
When the Discord plugin stops during a rollout, it closes its gateway connection with code 1000. Discord invalidates a session closed with 1000 or 1001, so the replacement plugin can't resume, and a message sent during the rollout gap can't be replayed. This closes with 1012 (
CloseCode::Restart) instead, which keeps the session valid.Ref #27, which stays open until production's connector gateway includes this. serenorg/seren-core#1215's Core change must not ship before that: it lets the plugin stop cleanly, and with the old close code a clean stop ends the session.
Test evidence
5bfd0dd): thechannel-discordplugin's 185 of 185 tests passed at the production stack.gateway_shutdown_resumes_a_message_received_while_disconnected, drives a stand-in for Discord: it checks the close code, then that a message sent while disconnected is replayed on resume with the same event identity.Taariq Lewis, SerenAI, Paloma, and Volume at https://serendb.com
Email: hello@serendb.com