diff --git a/application/Espo/Core/Job/QueueName.php b/application/Espo/Core/Job/QueueName.php new file mode 100644 index 0000000000..01e99ca4fb --- /dev/null +++ b/application/Espo/Core/Job/QueueName.php @@ -0,0 +1,48 @@ + $duplicate->id ], 'executeAt' => $executeAt, - 'queue' => 'q1', + 'queue' => QueueName::Q1, ]); $this->entityManager->saveEntity($job); diff --git a/application/Espo/Core/Password/Recovery.php b/application/Espo/Core/Password/Recovery.php index 6464acd040..6b7dc9930a 100644 --- a/application/Espo/Core/Password/Recovery.php +++ b/application/Espo/Core/Password/Recovery.php @@ -44,6 +44,7 @@ use Espo\Core\{ Htmlizer\Factory as HtmlizerFactory, Utils\TemplateFileManager, Utils\Log, + Job\QueueName, }; use DateTime; @@ -239,7 +240,7 @@ class Recovery 'methodName' => 'removeChangePasswordRequestJob', 'data' => ['id' => $passwordChangeRequest->id], 'executeTime' => $dt->format('Y-m-d H:i:s'), - 'queue' => 'q1', + 'queue' => QueueName::Q1, ]); $timeDiff = $this->getDelay() - floor((microtime(true) - $microtime) / 1000); diff --git a/application/Espo/Hooks/Common/AssignmentEmailNotification.php b/application/Espo/Hooks/Common/AssignmentEmailNotification.php index 95688e6931..d82631616b 100644 --- a/application/Espo/Hooks/Common/AssignmentEmailNotification.php +++ b/application/Espo/Hooks/Common/AssignmentEmailNotification.php @@ -35,6 +35,7 @@ use Espo\Core\{ Utils\Config, ORM\EntityManager, ApplicationState, + Job\QueueName, }; class AssignmentEmailNotification @@ -129,7 +130,7 @@ class AssignmentEmailNotification 'entityType' => $entity->getEntityType(), ], 'executeTime' => date('Y-m-d H:i:s'), - 'queue' => 'e0', + 'queue' => QueueName::E0, ]); $this->entityManager->saveEntity($job); diff --git a/application/Espo/Hooks/Common/Stream.php b/application/Espo/Hooks/Common/Stream.php index a261914a1c..551c1ab562 100644 --- a/application/Espo/Hooks/Common/Stream.php +++ b/application/Espo/Hooks/Common/Stream.php @@ -35,6 +35,7 @@ use Espo\Core\{ Utils\Metadata, ORM\EntityManager, ServiceFactory, + Job\QueueName, }; use Espo\Entities\User; @@ -321,7 +322,7 @@ class Stream 'entityType' => $entity->getEntityType(), 'entityId' => $entity->id ], - 'queue' => 'q1' + 'queue' => QueueName::Q1, ]); $this->entityManager->saveEntity($job); @@ -408,7 +409,7 @@ class Stream 'entityType' => $entity->getEntityType(), 'entityId' => $entity->id ], - 'queue' => 'q1' + 'queue' => QueueName::Q1, ]); $this->entityManager->saveEntity($job); diff --git a/application/Espo/Jobs/ProcessJobQueueE0.php b/application/Espo/Jobs/ProcessJobQueueE0.php index 0fee47ac0c..82a185d1c5 100644 --- a/application/Espo/Jobs/ProcessJobQueueE0.php +++ b/application/Espo/Jobs/ProcessJobQueueE0.php @@ -33,6 +33,7 @@ use Espo\Core\{ Job\JobManager, Utils\Config, Job\Job, + Job\QueueName, }; class ProcessJobQueueE0 implements Job @@ -51,6 +52,6 @@ class ProcessJobQueueE0 implements Job { $limit = $this->config->get('jobE0MaxPortion', 100); - $this->jobManager->processQueue('e0', $limit); + $this->jobManager->processQueue(QueueName::E0, $limit); } } diff --git a/application/Espo/Jobs/ProcessJobQueueQ0.php b/application/Espo/Jobs/ProcessJobQueueQ0.php index c369ab4a13..3eb18da4bc 100644 --- a/application/Espo/Jobs/ProcessJobQueueQ0.php +++ b/application/Espo/Jobs/ProcessJobQueueQ0.php @@ -33,6 +33,7 @@ use Espo\Core\{ Job\JobManager, Utils\Config, Job\Job, + Job\QueueName, }; class ProcessJobQueueQ0 implements Job @@ -51,6 +52,6 @@ class ProcessJobQueueQ0 implements Job { $limit = $this->config->get('jobQ0MaxPortion', 200); - $this->jobManager->processQueue('q0', $limit); + $this->jobManager->processQueue(QueueName::Q0, $limit); } } diff --git a/application/Espo/Jobs/ProcessJobQueueQ1.php b/application/Espo/Jobs/ProcessJobQueueQ1.php index 5414910e24..678df8f338 100644 --- a/application/Espo/Jobs/ProcessJobQueueQ1.php +++ b/application/Espo/Jobs/ProcessJobQueueQ1.php @@ -33,6 +33,7 @@ use Espo\Core\{ Job\JobManager, Utils\Config, Job\Job, + Job\QueueName, }; class ProcessJobQueueQ1 implements Job @@ -51,6 +52,6 @@ class ProcessJobQueueQ1 implements Job { $limit = $this->config->get('jobQ1MaxPortion', 500); - $this->jobManager->processQueue('q1', $limit); + $this->jobManager->processQueue(QueueName::Q1, $limit); } } diff --git a/application/Espo/Services/Pdf.php b/application/Espo/Services/Pdf.php index 24845cc9c7..dfaa9656ed 100644 --- a/application/Espo/Services/Pdf.php +++ b/application/Espo/Services/Pdf.php @@ -46,6 +46,7 @@ use Espo\Core\{ ORM\Entity, Select\SelectBuilderFactory, Record\ServiceContainer, + Job\QueueName, }; use Espo\{ @@ -243,7 +244,7 @@ class Pdf 'id' => $attachment->id ], 'executeTime' => (new DateTime())->modify('+' . $this->removeMassFilePeriod)->format('Y-m-d H:i:s'), - 'queue' => 'q1', + 'queue' => QueueName::Q1, ]); $this->entityManager->saveEntity($job); diff --git a/application/Espo/Tools/LeadCapture/LeadCapture.php b/application/Espo/Tools/LeadCapture/LeadCapture.php index daaa6fa49a..419bf2cda1 100644 --- a/application/Espo/Tools/LeadCapture/LeadCapture.php +++ b/application/Espo/Tools/LeadCapture/LeadCapture.php @@ -42,6 +42,7 @@ use Espo\Core\{ Utils\DateTime as DateTimeUtil, ServiceFactory, Utils\Log, + Job\QueueName, }; use Espo\{ @@ -199,7 +200,7 @@ class LeadCapture 'data' => (object) [ 'id' => $uniqueId->get('name'), ], - 'queue' => 'e0', + 'queue' => QueueName::E0, ]); $this->entityManager->saveEntity($job);