Skip to content

CP-51690: fix timeouts shorter than 10s in the periodic scheduler #6122

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 2 commits into from
Nov 19, 2024

Conversation

edwintorok
Copy link
Contributor

When XAPI's queue is empty the periodic scheduler would sleep for 10s, during which time newly added jobs would get ignored.

This is mostly noticeable during unit tests, but we cannot rely on the queue not being empty in production either.
It is better to wake up the scheduler on the soonest of these 2 events:

  • after 10s
  • when a new task gets added to the queue

No functional change.

Signed-off-by: Edwin Török <edwin.torok@cloud.com>
…queue

Wake up the scheduler immediately when there are more tasks.
Otherwise timeouts <10s may not work correctly, and it is difficult to test the
periodic scheduler if you need to wait 10s for it to start working.

If there are no tasks, then it will still sleep efficiently, but as soon as
more tasks are added (with [~signal:true], which is the default) it will
immediately wake up and calculate the next sleep time.

In practice it is probably quite rare for XAPI's queue to be empty (there are usually periodic tasks),
but we cannot rely on this.

Signed-off-by: Edwin Török <edwin.torok@cloud.com>
@edwintorok
Copy link
Contributor Author

I removed the empty base commit

@robhoes robhoes merged commit 7b5dbcb into xapi-project:feature/perf Nov 19, 2024
15 checks passed
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