Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Only attempt resume if the gateway says we can #566

Merged
merged 1 commit into from
May 4, 2024

Conversation

jchristgit
Copy link
Collaborator

Per 1 and 2, if the d field is set to true we may attempt to
resume again with the same session, otherwise we should not. nostrum
would previously loop on trying to resume on the same session after an
invalid session was sent, and the behaviour of simply sending an
identify payload did not work as expected. When the session that we try
to resume with is invalid, perform a reconnect and do the whole
handshake, greeting and meeting the parents thing all over again.

Copy link
Collaborator

@jb3 jb3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR introduces some warnings of unused variables (can_resume?), can we confirm if that is intentional and amend if not? (I am happy to fix this if you can't right now)

@jchristgit
Copy link
Collaborator Author

This PR introduces some warnings of unused variables (can_resume?), can we confirm if that is intentional and amend if not? (I am happy to fix this if you can't right now)

it's intentional although I haven't seen the warning until now. I will update this to underscore it

Per [1] and [2], if the `d` field is set to `true` we may attempt to
resume again with the same session, otherwise we should not. nostrum
would previously loop on trying to resume on the same session after an
invalid session was sent, and the behaviour of simply sending an
identify payload did not work as expected. When the session that we try
to resume with is invalid, perform a reconnect and do the whole
handshake, greeting and meeting the parents thing all over again.

[1]: https://discord.com/developers/docs/topics/gateway-events#invalid-session
[2]: https://discord.com/developers/docs/topics/gateway#resuming
@jchristgit jchristgit force-pushed the try-resume-only-if-possible branch from 035839f to e303f2b Compare May 4, 2024 05:23
@jb3 jb3 merged commit b101e10 into master May 4, 2024
9 checks passed
@jb3 jb3 deleted the try-resume-only-if-possible branch May 4, 2024 12:51
@jb3
Copy link
Collaborator

jb3 commented May 4, 2024

Thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants