feat: convert foreman service to docket perpetual function #19741
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Converts the
ForemanLoopService to a docket perpetual function (monitor_worker_health).Foreman monitors workers and marks stale resources as offline/not ready:
last_polledtime as not readylast_polledtime as not readyUnlike other service conversions (cancellation_cleanup, pause_expirations, late_runs, repossessor), foreman doesn't use the find-and-flood pattern. All operations run within a single perpetual function since the work is lightweight and doesn't benefit from task delegation.
Changes
Foremanclass tomonitor_worker_health()perpetual function_mark_online_workers_without_recent_heartbeat_as_offline(),_mark_work_pools_as_not_ready(),_mark_deployments_as_not_ready(),_mark_work_queues_as_not_ready()Foremanfrombase.pyservice registrymonitor_worker_health()directly instead ofForeman().run_once()test_perpetual_services.pyPart of the staged rollout converting LoopService background services to docket perpetual functions:
Test plan
🤖 Generated with Claude Code