Skip to content

Commit aa3594b

Browse files
committed
fix(QueueMapper): Do not mutate queueItem
This prevents the looping on landmarks photos fixes #1133 Signed-off-by: Marcel Klehr <mklehr@gmx.net>
1 parent 09f7dcc commit aa3594b

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

lib/Db/QueueMapper.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,9 @@ public function insertIntoQueue(string $model, QueueFile $file) : QueueFile {
133133
'update' => $qb->createPositionalParameter($file->getUpdate(), IQueryBuilder::PARAM_BOOL)
134134
])
135135
->executeStatement();
136-
$file->setId($qb->getLastInsertId());
137-
return $file;
136+
$insertedFile = clone $file;
137+
$insertedFile->setId($qb->getLastInsertId());
138+
return $insertedFile;
138139
}
139140

140141
public function clearQueue(string $model): void {

tests/ClassifierTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,10 @@ public function testLandmarksPipeline() : void {
446446
list($classifier, ) = $this->jobList->getJobs(ClassifyImagenetJob::class, 1, 0);
447447
$classifier->start($this->jobList);
448448

449+
self::assertCount(0,
450+
$this->queue->getFromQueue(ImagenetClassifier::MODEL_NAME, $storageId, $rootId, 100),
451+
'imagenet queue should be empty after classifying an image that is forwarded to landmarks');
452+
449453
self::assertTrue($this->jobList->has(ClassifyLandmarksJob::class, [
450454
'storageId' => $storageId,
451455
'rootId' => $rootId

0 commit comments

Comments
 (0)