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 jobs checking #30

Merged
merged 6 commits into from
Apr 15, 2024
Merged

Fix jobs checking #30

merged 6 commits into from
Apr 15, 2024

Conversation

webmaster128
Copy link
Contributor

Before this PR, the jobs were loaded in descending order. This could lead to situations where the result only contained future rounds because it was limited. The rounds in the past would remain behind the limit and only processed if there are no future round anymore.


// Use jobs_asc because with jobs_desc all entries in the result might be in the (far) future,
// leading to cases where the unprocesses jobs in the past are not processed anymore.
const query = { jobs_asc: { offset: null, limit: queryLimit } };
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This jobs_desc -> jobs_asc is the main change here

Copy link
Contributor

@kaisbaccour kaisbaccour left a comment

Choose a reason for hiding this comment

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

This is amazing. I was a bit worried with the 50 limit because it's something we would always have to check and that wouldn't be scalable/maintainable unless we remove getRandomnessAfter(). With this change even a limit of 1 would eventually process all jobs. Thank you so much.
Handling the sequence mismatch is also great. Well done!

@webmaster128 webmaster128 merged commit 41113c3 into main Apr 15, 2024
1 check passed
@webmaster128 webmaster128 deleted the job-checking branch April 15, 2024 13:33
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