Skip to content

server: Run recover in batches #1814

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

Merged
merged 1 commit into from
Mar 11, 2025
Merged

Conversation

future-highway
Copy link
Contributor

The intent of the recovery loop seems to be to recover up to the RECOVERY_LIMIT in increments of BATCH_SIZE, but the limit arg is currently set to RECOVERY_LIMIT.

There also seems to be a typo in how the loop breaks, which could cause an excessive number of messages to be recovered: num_done > RECOVERY_LIMIT instead of num_done >= RECOVERY_LIMIT (equal should also break the loop).

Motivation

This change should result in a more reasonable load per request on external resources (i.e., db & queue) as seemingly originally intended. However, it will likely make the recovery process slower as the number of messages to recover approaches the limit; what was 1 loop will now be up to 100, at the limit.

Solution

Set limit to BATCH_SIZE and stop when num_done >= RECOVERY_LIMIT`.

@future-highway future-highway requested a review from a team as a code owner March 11, 2025 15:36
@tasn
Copy link
Member

tasn commented Mar 11, 2025

Thank you for the PR, I asked the team to review!

Copy link
Contributor

@svix-gabriel svix-gabriel left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this!

@svix-gabriel svix-gabriel merged commit 82e4dc3 into svix:main Mar 11, 2025
12 checks passed
@future-highway future-highway deleted the recovery-fix branch March 12, 2025 01:15
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.

3 participants