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 draining of delayed worker #3999

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Improve draining of delayed worker #3999

wants to merge 7 commits into from

Conversation

johha
Copy link
Contributor

@johha johha commented Sep 30, 2024

This change improves the draining behavior of the delayed workers:

  • Add shutdown_delayed_worker method to Drain class which configurable timeout
  • Add jobs:clear_pending_locks rake task to clear pending job locks in the delayed jobs table for the given worker.

Additionally it allows operators to set the number of delayed worker threads and the grace period after which threads will be killed via the jobs rake task.

Changes will be integrated into capi release with a follow up PR.

  • I have reviewed the contributing guide

  • I have viewed, signed, and submitted the Contributor License Agreement

  • I have made this pull request to the main branch

  • I have run all the unit tests using bundle exec rake

  • I have run CF Acceptance Tests

Co-authored-by: Johannes Haass <[email protected]>
Rake task 'jobs:clear_locks_for_current_worker[worker_name]' allows
operators to clear all locks for a given worker in the delayed jobs table.

Could be also used in a drain script to ensure that there are no pending
jobs.
This change allows operators to set the number of threads to start
multiple delayed worker threads (ThreadedWorker).
Additionally the grace period can be configured after which the threads
will be killed.
Both are implemented as parameters in the jobs rake task.
The existing `number_of_worker_threads` in the api and worker schema was
removed.
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.

1 participant