From 85bea9433dcff85e8741fb402c23f1308f3a8b8f Mon Sep 17 00:00:00 2001 From: rsgrinko Date: Fri, 22 Jul 2022 15:54:58 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B4=D0=B0=D1=82=D0=B0=20=D1=81=D0=BE=D0=B7?= =?UTF-8?q?=D0=B4=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B2=20MQResponse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/lib/Core/Models/MQ.class.php | 11 +++++++++++ core/lib/Core/Models/MQResponse.class.php | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/core/lib/Core/Models/MQ.class.php b/core/lib/Core/Models/MQ.class.php index 8688e3d..71bc779 100644 --- a/core/lib/Core/Models/MQ.class.php +++ b/core/lib/Core/Models/MQ.class.php @@ -429,6 +429,17 @@ $this->DB->query('DELETE FROM ' . self::TABLE_HISTORY); } + /** + * Полная очистка диспетчера очереди с остановкой воркеров + * + * @return void + * @throws CoreException + */ + public function flush(): void + { + $this->stopAllWorkers(); + $this->DB->query('TRUNCATE ' . self::TABLE . '; TRUNCATE ' . self::TABLE_HISTORY . ';'); + } /** * Массовое создание заданий * diff --git a/core/lib/Core/Models/MQResponse.class.php b/core/lib/Core/Models/MQResponse.class.php index 9848e21..a4b82e5 100644 --- a/core/lib/Core/Models/MQResponse.class.php +++ b/core/lib/Core/Models/MQResponse.class.php @@ -40,6 +40,11 @@ */ private $taskId = 0; + /** + * @var ?string $dateCreated Дата создания + */ + private $dateCreated = null; + /** * @var string $status Статус задания */ @@ -70,6 +75,7 @@ */ public function __construct() { + $this->dateCreated = date(MQ::DATETIME_FORMAT); } /** @@ -128,6 +134,16 @@ return $this->status; } + /** + * Получение даты создания задания + * + * @return string|null + */ + public function getDateCreated(): ?string + { + return $this->dateCreated; + } + /** * Получение параметров *