Skip to content

Commit 90423a4

Browse files
authored
Merge pull request #40 from Oefenweb/make-gc-more-efficient-3x
Make gc more efficient
2 parents b53bebc + 0f1dbcb commit 90423a4

File tree

3 files changed

+10
-17
lines changed

3 files changed

+10
-17
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ Thumbs.db
2323
!empty
2424
/node_modules
2525
/vendor
26+
composer.lock

.travis/script.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ elif [ "${PHP_MD}" = '1' ]; then
3131

3232
vendor/bin/phpmd . text phpmd.xml --suffixes php --exclude "${excludePathsJoined}" || true;
3333
elif [ "${PHP_STAN}" = '1' ]; then
34-
vendor/bin/phpstan analyse -c phpstan.neon -l 5 src/;
34+
vendor/bin/phpstan analyse -c phpstan.neon -l 5 src/;
3535
elif [ "${PHP_PHAN}" = '1' ]; then
36-
vendor/bin/phan;
36+
vendor/bin/phan;
3737
elif [ "${PHP_COVERAGE}" = '1' ]; then
3838
vendor/bin/phpunit --coverage-clover=clover.xml;
3939
else

src/Model/Table/QueuedTasksTable.php

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ public function requestJob(array $capabilities, array $types = []): ?QueuedTask
315315

316316
// Generate the task specific conditions.
317317
foreach ($capabilities as $task) {
318-
list ($plugin, $name) = pluginSplit($task['name']);
318+
list (, $name) = pluginSplit($task['name']);
319319
$timeoutAt = $now->copy();
320320
$tmp = [
321321
'task' => $name,
@@ -457,18 +457,14 @@ public function rerun($taskName): int
457457
*/
458458
public function cleanOldJobs(array $capabilities): void
459459
{
460-
$conditions = [];
461-
462-
// Generate the job specific conditions
463460
foreach ($capabilities as $task) {
464-
list ($plugin, $name) = pluginSplit($task['name']);
465-
$conditions['OR'][] = [
461+
list (, $name) = pluginSplit($task['name']);
462+
$conditions = [
466463
'task' => $name,
467464
'completed <' => date('Y-m-d H:i:s', time() - (int)$task['cleanupTimeout'])
468465
];
466+
$this->deleteAll($conditions);
469467
}
470-
471-
$this->deleteAll($conditions);
472468
}
473469

474470
/**
@@ -479,18 +475,14 @@ public function cleanOldJobs(array $capabilities): void
479475
*/
480476
public function cleanFailedJobs(array $capabilities): void
481477
{
482-
$conditions = [];
483-
484-
// Generate the job specific conditions.
485478
foreach ($capabilities as $task) {
486-
list ($plugin, $name) = pluginSplit($task['name']);
487-
$conditions['OR'][] = [
479+
list (, $name) = pluginSplit($task['name']);
480+
$conditions = [
488481
'task' => $name,
489482
'failed_count >' => $task['retries']
490483
];
484+
$this->deleteAll($conditions);
491485
}
492-
493-
$this->deleteAll($conditions);
494486
}
495487

496488
/**

0 commit comments

Comments
 (0)