Skip to content

Commit

Permalink
Explicitly configure worker sleep delay (#499)
Browse files Browse the repository at this point in the history
Allows operators to provide a different sleep delay for the delayed
workers. This can be used to e.g. reduce the database load of the
delayed_jobs table.
  • Loading branch information
johha authored Dec 19, 2024
1 parent af0d494 commit 8d74dd1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions jobs/cloud_controller_ng/spec
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,9 @@ properties:
cc.jobs.global.timeout_in_seconds:
description: "The longest any job can take before it is cancelled unless overridden per job"
default: 14400 # 4 hours
cc.jobs.global.worker_sleep_delay_in_seconds:
description: "The amount of time in seconds delayed workers sleep when no jobs are found"
default: 5
cc.jobs.queues.cc_generic.timeout_in_seconds:
description: "The longest jobs in the cc-generic queue can take before they are cancelled"
cc.jobs.blobstore_delete.timeout_in_seconds:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ jobs:
enable_dynamic_job_priorities: <%= p("cc.jobs.enable_dynamic_job_priorities") %>
global:
timeout_in_seconds: <%= p("cc.jobs.global.timeout_in_seconds") %>
worker_sleep_delay_in_seconds: <%= p("cc.jobs.global.worker_sleep_delay_in_seconds") %>
queues:
<% if (timeout = p("cc.jobs.queues.cc_generic.timeout_in_seconds", nil)) %>
cc_generic:
Expand Down
3 changes: 3 additions & 0 deletions jobs/cloud_controller_worker/spec
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ properties:
cc.jobs.global.timeout_in_seconds:
description: "The longest any job can take before it is cancelled unless overriden per job"
default: 14400 # 4 hours
cc.jobs.global.worker_sleep_delay_in_seconds:
description: "The amount of time in seconds delayed workers sleep when no jobs are found"
default: 5
cc.jobs.blobstore_delete.timeout_in_seconds:
description: "The longest this job can take before it is cancelled"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
enable_dynamic_job_priorities: <%= link("cloud_controller_internal").p("cc.jobs.enable_dynamic_job_priorities") %>
global:
timeout_in_seconds: <%= p("cc.jobs.global.timeout_in_seconds") %>
worker_sleep_delay_in_seconds: <%= p("cc.jobs.global.worker_sleep_delay_in_seconds") %>
queues: {}
<% if_p("cc.jobs.blobstore_delete.timeout_in_seconds") do |timeout| %>
blobstore_delete:
Expand Down

0 comments on commit 8d74dd1

Please sign in to comment.