! MQ некоторые корректировки из эксперимента

This commit is contained in:
rsgrinko committed 2022-07-10 10:29:54 +03:00
1 parent d499831698
commit a996498a30
3 files changed
+15 -13

No files matched your search

+10 -3
View File
@@ -96,10 +96,15 @@
<!-- table --> <!-- table -->
<div class="row"> <div class="row">
<div class="col-md-12r"> <div class="col-md-12">
<p class="lead">Задания в очереди</p> <div class="panel panel-primary">
<div class="panel-heading">
<h4 class="panel-title">Очередь</h4>
<p>Список текущих заданий очереди</p>
</div><!-- panel-heading -->
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-primary <?/*table-hover*/?> mb30"> <table class="table table-primary mb30">
<thead> <thead>
<tr> <tr>
<th></th> <th></th>
@@ -159,8 +164,10 @@
</tbody> </tbody>
</table> </table>
</div><!-- table-responsive --> </div><!-- table-responsive -->
</div> </div>
</div> </div>
<!-- end table --> <!-- end table -->
</div><!-- contentpanel --> </div><!-- contentpanel -->
<?php require_once __DIR__ . '/inc/footer.php'; ?> <?php require_once __DIR__ . '/inc/footer.php'; ?>
+1
View File
@@ -193,6 +193,7 @@
try { try {
$stmt = $this->db->query($sql); $stmt = $this->db->query($sql);
} catch (\Throwable $t) { } catch (\Throwable $t) {
sendTelegram('SQL ERROR: ' . $sql);
throw new CoreException('В SQL запросе произошла ошибка', CoreException::ERROR_SQL_QUERY); throw new CoreException('В SQL запросе произошла ошибка', CoreException::ERROR_SQL_QUERY);
} }
$this->lastInsertId = $this->db->lastInsertId() ?? null; $this->lastInsertId = $this->db->lastInsertId() ?? null;
+4 -10
View File
@@ -268,12 +268,6 @@
*/ */
private function getActiveTasks(): ?array private function getActiveTasks(): ?array
{ {
/*$res = $this->DB->query('SELECT * FROM ' . self::TABLE . ' WHERE active="' . self::VALUE_Y . '" AND in_progress="' . self::VALUE_N . '" ORDER BY priority, id ASC');
if($res) {
return $res;
} else {
return null;
}*/
return $this->DB->getItems( return $this->DB->getItems(
self::TABLE, [ self::TABLE, [
'active' => self::VALUE_Y, 'active' => self::VALUE_Y,
@@ -290,7 +284,7 @@
* @return void * @return void
* @throws CoreException * @throws CoreException
*/ */
private function setTasksActiveStatus() private function setTasksActiveStatus(): void
{ {
$countTasks = $this->getActiveTasksCount(); $countTasks = $this->getActiveTasksCount();
@@ -375,7 +369,7 @@
* *
* @param int $priority Приоритет * @param int $priority Приоритет
* *
* @return void * @return MQ
*/ */
public function setPriority(int $priority): self public function setPriority(int $priority): self
{ {
@@ -390,7 +384,7 @@
* @param string $method Метод класса * @param string $method Метод класса
* @param ?array $params Массив параметров * @param ?array $params Массив параметров
* *
* @return int|null Идентификатор созданного задания * @return \Core\Models\MQResponse Идентификатор созданного задания
* @throws CoreException * @throws CoreException
*/ */
public function createTask(?string $class = null, string $method, ?array $params = null): MQResponse public function createTask(?string $class = null, string $method, ?array $params = null): MQResponse
@@ -494,7 +488,7 @@
if (USE_LOG) { if (USE_LOG) {
Log::logToFile( Log::logToFile(
'Заданиt ' . $taskId . ' взято в работу', 'Задание ' . $taskId . ' взято в работу',
self::LOG_FILE, self::LOG_FILE,
['taskId' => $taskId], ['taskId' => $taskId],
LOG_DEBUG LOG_DEBUG