Skip to content

Conversation

@backportbot-libresign
Copy link

Backport of PR #6551

Introduces WorkerJobCounter class that counts pending SignFileJob and
SignSingleFileJob instances using IJobList::countByClass(). This enables
the worker system to make informed decisions about how many workers to
start based on actual workload.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Changes worker stop_after parameter from 1h to 30m to reduce resource
consumption and allow for more frequent worker refreshes.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Integrate WorkerJobCounter to check pending work before starting workers
- Start only the minimum number of workers needed (min of pending jobs and desired workers)
- Return early with 0 workers if no pending jobs exist
- Rename constructor parameters to follow class naming convention
- Extract business logic into self-documenting methods:
  * hasNoPendingWork(): checks if there are jobs to process
  * limitWorkersByAvailableWork(): calculates workers needed
- Move WorkerHealthService to correct Worker namespace
- Add isAsyncLocalEnabled() public method

This reduces unnecessary worker spawning and improves resource efficiency.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Adds 8 test cases covering:
- Zero pending jobs
- Counting SignFileJob instances
- Counting SignSingleFileJob instances
- Summing both job types
- Ignoring other job types
- Exception handling
- Empty array handling
- Large number handling

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Adds test cases for:
- No workers started when no pending jobs exist
- Starting only needed workers based on pending job count
- Limiting workers by both pending jobs and running workers
- Starting fewer workers when less jobs than gap
- Starting one worker when only one job pending
- Proper handling when async local is disabled

Updates all mock properties to follow class naming convention.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Update imports in SignFileController and FileProgressController to use
the correct Worker namespace for WorkerHealthService after moving the
class to lib/Service/Worker/

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@github-project-automation github-project-automation bot moved this to 0. Needs triage in Roadmap Jan 23, 2026
@backportbot-libresign backportbot-libresign bot added this to the Next Patch (32) milestone Jan 23, 2026
@vitormattos vitormattos merged commit 9454f56 into stable32 Jan 23, 2026
34 checks passed
@vitormattos vitormattos deleted the backport/6551/stable32 branch January 23, 2026 18:03
@github-project-automation github-project-automation bot moved this from 0. Needs triage to 4. to release in Roadmap Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 4. to release

Development

Successfully merging this pull request may close these issues.

2 participants