Conversation
If there's an idle instance, and the project is not at a max concurrent limit, request 1 instance and 1 second
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adjusts client work-fetch behavior for projects with resource_share == 0 to avoid over-requesting work, and to respect per-project max-concurrent limits.
Changes:
- Request only 1 instance / 1 second of work (instead of per-idle-instance) when a zero-resource-share project has idle capacity.
- Skip requesting work entirely when the project is already at its max concurrent limit.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (nidle_now) { | ||
| // unless we're at the max concurrent limit | ||
| if (p->app_configs.project_has_mc | ||
| && p->app_configs.project_max_concurrent | ||
| && p->proj_n_concurrent >= p->app_configs.project_max_concurrent | ||
| ) { | ||
| return; | ||
| } | ||
| req_instances = 1; | ||
| req_secs = 1; | ||
| } | ||
| return; |
There was a problem hiding this comment.
In the resource_share == 0 branch, set_request() now returns without setting req_instances/req_secs when nidle_now == 0, and also returns early (line 263) when at max concurrent. If these request fields are not re-initialized earlier in set_request(), this can leave stale values from a previous call and cause an unintended request. Consider explicitly setting req_instances (and any related request duration fields) to 0 before returning in these paths.
| @@ -254,8 +254,17 @@ void RSC_WORK_FETCH::set_request(PROJECT* p) { | |||
| // if backup project, fetch 1 job per idle instance | |||
There was a problem hiding this comment.
The comment says 'fetch 1 job per idle instance', but the new behavior requests at most 1 instance total (when any idle instance exists), and otherwise requests nothing. Update the comment to match the new logic to avoid misleading future changes.
| // if backup project, fetch 1 job per idle instance | |
| // if backup project and any instance is idle, fetch at most 1 job |
If there's an idle instance, and the project is not at a max concurrent limit, request 1 instance and 1 second
Fixes #7010
Summary by cubic
Reduce work fetch for backup projects (resource_share = 0): set
req_instancesandreq_secsto 0, then request only 1 instance for 1 second when there’s an idle instance, skipping fetch if at the project’s max concurrent limit. Prevents over-fetching and avoids stale request values.Written for commit ee2405a. Summary will update on new commits.