Code Duplication    Length = 11-12 lines in 2 locations

src/Service/QueueRepublishService.php 1 location

@@ 39-50 (lines=12) @@
36
37
        try {
38
            $republishedQueueIds = [];
39
            do {
40
                $queues = $this->queueService->getToRepublish($batchSize);
41
                if ($queues) {
42
                    foreach ($queues as $queue) {
43
                        $this->publisherFactory->republish($queue);
44
                        $this->queueService->flush($queue);
45
                        $republishedQueueIds[] = $queue->getId();
46
                    }
47
                }
48
                $this->queueService->commit();
49
                $this->publisherFactory->releaseAll();
50
            } while (count($queues) === $batchSize);
51
52
            if ($republishedQueueIds) {
53
                $this->logger->info(

src/Service/QueueRequeueService.php 1 location

@@ 39-49 (lines=11) @@
36
        $this->queueService->beginTransaction();
37
38
        try {
39
            do {
40
                $queues = $this->queueService->getToRestore($batchSize);
41
                if ($queues) {
42
                    foreach ($queues as $queue) {
43
                        $this->publisherFactory->requeue($queue);
44
                        $this->queueService->flush($queue);
45
                    }
46
                }
47
                $this->queueService->commit();
48
                $this->publisherFactory->releaseAll();
49
            } while (count($queues) === $batchSize);
50
        } catch (Throwable $exception) {
51
            $this->queueService->rollback();
52