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

chore: debounce polling of session info #675

Merged
merged 2 commits into from
Oct 12, 2023
Merged

Conversation

theborakompanioni
Copy link
Collaborator

@theborakompanioni theborakompanioni commented Oct 10, 2023

Before these changes, the /session endpoint has been polled with setInterval - i.e. rescheduled to run every 10 seconds, regardless of the response duration. On slow connection, e.g. over Tor, this can lead to requests queuing up.

After this commit, a new request is made 10 seconds after the previous response arrived, which mitigates the behaviour described above.

..by using setIntervalDebounced instead of setInterval
@theborakompanioni theborakompanioni added performance Performance and/or speed improvements refactoring Code refactoring without functional changes labels Oct 10, 2023
@theborakompanioni theborakompanioni self-assigned this Oct 10, 2023
@theborakompanioni theborakompanioni marked this pull request as ready for review October 11, 2023 09:44
Copy link

@editwentyone editwentyone left a comment

Choose a reason for hiding this comment

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

tACK

@theborakompanioni theborakompanioni merged commit c1d6bdf into master Oct 12, 2023
3 checks passed
@theborakompanioni theborakompanioni deleted the chore/intervals branch October 12, 2023 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance and/or speed improvements refactoring Code refactoring without functional changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants