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; + } + /** * Получение параметров *