From 6601901f01f0ed30232037c34a36b48f1610f77c Mon Sep 17 00:00:00 2001 From: rsgrinko Date: Fri, 22 Jul 2022 17:30:20 +0300 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B0=D1=81=D1=88=D0=B8=D1=80=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=B8=D0=BD=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D1=8E=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA=20=D0=B1=D0=B0?= =?UTF-8?q?=D0=B7=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/lib/Core/MQTasks.class.php | 3 +++ core/lib/Core/Models/DB.class.php | 7 +++++-- core/lib/Core/Models/MQ.class.php | 5 +++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/core/lib/Core/MQTasks.class.php b/core/lib/Core/MQTasks.class.php index 5ba3634..41158b0 100644 --- a/core/lib/Core/MQTasks.class.php +++ b/core/lib/Core/MQTasks.class.php @@ -190,6 +190,9 @@ $itemId = $DB->addItem('jokes', ['hash' => $hash, 'text' => $joke]); } } + if($i < 1 ) { + throw new CoreException('Новых шуток не найдено'); + } return 'Добавлено ' . $i . ' шуток из ' . count($arJokes); } diff --git a/core/lib/Core/Models/DB.class.php b/core/lib/Core/Models/DB.class.php index 06aac1e..d6157a0 100644 --- a/core/lib/Core/Models/DB.class.php +++ b/core/lib/Core/Models/DB.class.php @@ -213,9 +213,12 @@ try { $stmt = $this->db->query($sql); } catch (\Throwable $t) { - sendTelegram('SQL ERROR: ' . $sql); + sendTelegram( + '' . date('d.m.Y H:i:s') . '' . PHP_EOL . 'SQL ERROR: ' . PHP_EOL . $this->db->errorInfo()[2] . PHP_EOL + . 'QUERY: ' . PHP_EOL . $sql + ); if(DEBUG) { - throw new CoreException('В SQL запросе произошла ошибка. Запрос: ' . $sql, CoreException::ERROR_SQL_QUERY); + throw new CoreException('В SQL запросе произошла ошибка. '.$this->db->errorInfo()[2].' Запрос: ' . $sql, CoreException::ERROR_SQL_QUERY); } else { throw new CoreException('В SQL запросе произошла ошибка', CoreException::ERROR_SQL_QUERY); } diff --git a/core/lib/Core/Models/MQ.class.php b/core/lib/Core/Models/MQ.class.php index 71bc779..6b62099 100644 --- a/core/lib/Core/Models/MQ.class.php +++ b/core/lib/Core/Models/MQ.class.php @@ -355,7 +355,7 @@ // Добор заданий $this->setTasksActiveStatus(); - if ($this->hasMaxWorkers()) { + if ($this->hasMaxWorkers() && !$childProcess) { if (USE_LOG) { Log::logToFile( 'Достигнуто максимальное количество воркеров. Работает ' . $this->getCountWorkers() . '/' . self::WORKERS_LIMIT, @@ -438,7 +438,8 @@ public function flush(): void { $this->stopAllWorkers(); - $this->DB->query('TRUNCATE ' . self::TABLE . '; TRUNCATE ' . self::TABLE_HISTORY . ';'); + $this->DB->query('TRUNCATE ' . self::TABLE . ';'); + $this->DB->query('TRUNCATE ' . self::TABLE_HISTORY . ';'); } /** * Массовое создание заданий