From 72a62421ca3c413477ad3c4e7175796e8ac63116 Mon Sep 17 00:00:00 2001 From: Viktor Masicek Date: Tue, 4 Jun 2024 15:38:34 +0200 Subject: [PATCH] Enable set priority for BackgroundQueue job --- composer.json | 2 +- src/Service/QueueService.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 95a652e..de7d184 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "nette/mail": "~3.0", "nette/di": "^2.3 || ~3.0", "tracy/tracy": "^2.3", - "adt/background-queue": "^4.2" + "adt/background-queue": "^4.22" }, "autoload": { "psr-4": { diff --git a/src/Service/QueueService.php b/src/Service/QueueService.php index 9317b7f..60c6683 100644 --- a/src/Service/QueueService.php +++ b/src/Service/QueueService.php @@ -119,12 +119,12 @@ protected function createQueueEntry(\Nette\Mail\Message $message, $custom = []) * @param array|callable $custom * @return Entity\AbstractMailQueueEntry */ - public function enqueue(\Nette\Mail\Message $message, $custom = []) { + public function enqueue(\Nette\Mail\Message $message, $custom = [], ?int $backgroundQueuePriority = null) { $entry = $this->createQueueEntry($message, $custom); $this->em->persist($entry); $this->em->flush($entry); - $this->backgroundQueueService->publish($this->backgroundQueueCallbackName, [$entry->getId()]); + $this->backgroundQueueService->publish($this->backgroundQueueCallbackName, [$entry->getId()], null, null, false, null, $backgroundQueuePriority); return $entry; }