Skip to content

Commit e46b967

Browse files
Copilotmarcelklehr
andcommitted
fix: Fix task type starvation in WorkerCommand::processNextTask by shuffling providers
Co-authored-by: marcelklehr <986878+marcelklehr@users.noreply.github.com>
1 parent de9852e commit e46b967

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

core/Command/TaskProcessing/WorkerCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
110110
*/
111111
private function processNextTask(OutputInterface $output, array $taskTypes = []): bool {
112112
$providers = $this->taskProcessingManager->getProviders();
113+
// Shuffle providers to avoid starvation: if providers are always iterated
114+
// in the same order, a provider with a constant stream of tasks would
115+
// prevent all subsequent providers from ever being processed.
116+
shuffle($providers);
113117

114118
foreach ($providers as $provider) {
115119
if (!$provider instanceof ISynchronousProvider) {

0 commit comments

Comments
 (0)