[*] MQ добавил поиск и исправление зависших заданий

This commit is contained in:
rsgrinko committed 2022-07-08 15:35:00 +03:00
1 parent 645b5c3a00
commit 1add64675b
3 files changed
+22 -3

No files matched your search

+1
View File
@@ -178,6 +178,7 @@
*/
public function query(string $sql, bool $returnObject = false)
{
sendTelegram($sql);
$startTime = microtime(true);
self::$quantity++;
try {
+9 -2
View File
@@ -142,7 +142,7 @@
*/
public static function test2(...$params): string
{
sleep(rand(10, 30));
//sleep(rand(10, 30));
$result = rand(0, 100);
if (($result % 2) == 0) {
throw new CoreException('Сервер обмена временно недоступен');
@@ -719,7 +719,14 @@
}
}
$this->DB->query('UPDATE ' . self::TABLE . ' SET active="' . self::VALUE_N . '", in_progress="' . self::VALUE_N . '" WHERE id in(' . implode(',', $arStuckTasks) . ')');
if (!empty($arStuckTasks)) {
$this->DB->query(
'UPDATE ' . self::TABLE . ' SET active="' . self::VALUE_N . '", in_progress="' . self::VALUE_N . '" WHERE id in(' . implode(
',',
$arStuckTasks
) . ')'
);
}
Log::logToFile(
'Задания были возвращены в работу',
self::LOG_FILE,