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

Fix thundering herd problem with debouncer #1230

Merged
merged 5 commits into from
Jan 27, 2021
Merged

Conversation

Half-Shot
Copy link
Contributor

There is a bug in the debouncer code that would often delay the debounce for the min period rather than a random period. This change ensures that two debounce efforts are hopefully not processed at the same time.

@Half-Shot Half-Shot requested a review from a team January 27, 2021 12:19
Copy link
Contributor

@jaller94 jaller94 left a comment

Choose a reason for hiding this comment

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

Instead of having private functions (which are only used once), we could also access the variables directly.

@@ -61,15 +61,14 @@ export class QuitDebouncer {
// Nobody to debounce, yay.
return;
}
const delay = Math.max(server.getQuitDebounceDelayMinMs(), server.getQuitDebounceDelayMaxMs() * Math.random());
log.info(`Will attempt to reconnect users for ${channel} after ${delay}ms`)
Copy link
Contributor

Choose a reason for hiding this comment

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

This line uses delay which is no longer defined.

@Half-Shot Half-Shot merged commit b784f05 into develop Jan 27, 2021
@Half-Shot Half-Shot deleted the hs/fix-stampde branch January 27, 2021 12:49
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.

2 participants