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

Improve retries and add more guarding code #75

Merged
merged 9 commits into from Nov 8, 2023
Merged

Conversation

pavkam
Copy link
Contributor

@pavkam pavkam commented Nov 2, 2023

This PR re-arranges some code to move "get a new token" retry from inside the "event listener's" loop and join it to the main retry loop.

This is to avoid any hypothetical situation when Ably misbehaves about our tokens' validity and we constantly try to obtain a new token and connect to Ably, thus entering an unwanted loop.

To improve things, I have also made sure that when we connect successfully, we reset the retry count to its default value to not exhaust retries on normal reconnects due to token expiration.

@pavkam pavkam self-assigned this Nov 2, 2023
src/main.ts Outdated Show resolved Hide resolved
src/main.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@rrpff rrpff left a comment

Choose a reason for hiding this comment

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

Changes look sound to me 👍

src/main.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@matus-vacula matus-vacula left a comment

Choose a reason for hiding this comment

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

Looks good!

Co-authored-by: Matus Vacula <vacula.matus@gmail.com>
@pavkam pavkam merged commit 8b7cd80 into main Nov 8, 2023
5 checks passed
@pavkam pavkam deleted the fix-repeat-auth-connect branch November 8, 2023 17:00
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.

None yet

4 participants