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

Improve throttling in sync jobs #17716

Merged
merged 8 commits into from
Jun 12, 2024
Merged

Improve throttling in sync jobs #17716

merged 8 commits into from
Jun 12, 2024

Conversation

kozlovb
Copy link
Contributor

@kozlovb kozlovb commented Jun 3, 2024

What does this PR do?

The DBMAsyncJob class allows synchronous and asynchronous jobs to run at fixed intervals.
This PR updates the approach to throttling in the sync jobs of the DBMAsyncJob class. Rather than pausing a thread after executing the job, we now evaluate whether the job should proceed. For example, if a job is scheduled to run every 10 seconds and only 1 second has passed since its last execution, the run_job_loop call will not trigger the job.

Motivation

This change enables running synchronous jobs on the main thread without putting the main thread to sleep after each job execution.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Changelog entries must be created for modifications to shipped code
  • Add the qa/skip-qa label if the PR doesn't need to be tested during QA.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

@kozlovb kozlovb added the qa/skip-qa Automatically skip this PR for the next QA label Jun 3, 2024
Copy link
Contributor

@jmeunier28 jmeunier28 left a comment

Choose a reason for hiding this comment

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

@kozlovb can you change the changelog to be this:

Fix the DBMAsyncJob class' job throttling feature by checking if the job should run instead of putting the thread to sleep. This prevents the class from holding the main check thread in cases where the job is run in Sync mode.

I don't think the current wording is straightforward, and our support people / customers will need to understand these changelog entries

@kozlovb
Copy link
Contributor Author

kozlovb commented Jun 6, 2024

@kozlovb can you change the changelog to be this:

Fix the DBMAsyncJob class' job throttling feature by checking if the job should run instead of putting the thread to sleep. This prevents the class from holding the main check thread in cases where the job is run in Sync mode.

I don't think the current wording is straightforward, and our support people / customers will need to understand these changelog entries

Let me try to rephrase but I dont have a mental modal of support people knowledge of our internal classes. May be we should rather indicate to them that it's some internal stuff ?

@jmeunier28
Copy link
Contributor

Let me try to rephrase but I dont have a mental modal of support people knowledge of our internal classes. May be we should rather indicate to them that it's some internal stuff ?

It's internal, but can affect the way the check runs. @christinaduffy57 maybe you can weigh in here? What would be useful to you in terms of wording? I think it makes sense to be a bit more technical

@kozlovb kozlovb merged commit c85f5ed into master Jun 12, 2024
242 of 249 checks passed
@kozlovb kozlovb deleted the BorisKozlov-improve-sync-jobs branch June 12, 2024 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants