From eb19283d96051e055b13df1e23cc0a7d6236bad9 Mon Sep 17 00:00:00 2001 From: Jonas L Date: Thu, 7 Jul 2022 16:47:56 +0200 Subject: [PATCH] fix(legacy): don't log 'could not obtain lock' exception (#1943) Fixes #1490 --- legacy/application/common/TaskManager.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/legacy/application/common/TaskManager.php b/legacy/application/common/TaskManager.php index 5027cf86f..a6c990771 100644 --- a/legacy/application/common/TaskManager.php +++ b/legacy/application/common/TaskManager.php @@ -63,10 +63,11 @@ final class TaskManager if ($task && $task->shouldBeRun()) { $task->run(); } - $this->_taskList[$taskName] = true; // Mark that the task has been checked/run. - // This is important for prioritized tasks that - // we need to run on every request (such as the - // schema check/upgrade) + // Mark that the task has been checked/run. + // This is important for prioritized tasks that + // we need to run on every request (such as the + // schema check/upgrade) + $this->_taskList[$taskName] = true; } /** @@ -99,10 +100,15 @@ final class TaskManager } $this->_updateLock($lock); $this->_con->commit(); - } catch (Exception $e) { + } catch (PDOException $e) { // We get here if there are simultaneous requests trying to fetch the lock row $this->_con->rollBack(); - Logging::warn($e->getMessage()); + + // Do not log 'could not obtain lock' exception + // SQLSTATE[55P03]: Lock not available: 7 ERROR: could not obtain lock on row in relation "cc_pref" + if ($e->getCode() != '55P03') { + Logging::warn($e->getMessage()); + } return; }