mirror of
https://github.com/nextcloud/server.git
synced 2026-06-03 13:58:55 -04:00
fix: Fix task type starvation in WorkerCommand::processNextTask by shuffling providers
Co-authored-by: marcelklehr <986878+marcelklehr@users.noreply.github.com>
This commit is contained in:
parent
e1208cad4c
commit
e84eedde7f
1 changed files with 4 additions and 0 deletions
|
|
@ -110,6 +110,10 @@ class WorkerCommand extends Base {
|
|||
*/
|
||||
private function processNextTask(OutputInterface $output, array $taskTypes = []): bool {
|
||||
$providers = $this->taskProcessingManager->getProviders();
|
||||
// Shuffle providers to avoid starvation: if providers are always iterated
|
||||
// in the same order, a provider with a constant stream of tasks would
|
||||
// prevent all subsequent providers from ever being processed.
|
||||
shuffle($providers);
|
||||
|
||||
foreach ($providers as $provider) {
|
||||
if (!$provider instanceof ISynchronousProvider) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue