Skip to content

Commit

Permalink
fix(legacy): don't log 'could not obtain lock' exception
Browse files Browse the repository at this point in the history
Fixes #1490
  • Loading branch information
jooola committed Jul 7, 2022
1 parent c7c5bad commit 04b05f3
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions legacy/application/common/TaskManager.php
Expand Up @@ -64,9 +64,9 @@ public function runTask($taskName)
$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)
// This is important for prioritized tasks that
// we need to run on every request (such as the
// schema check/upgrade)
}

/**
Expand Down Expand Up @@ -99,10 +99,14 @@ public function runTasks()
}
$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;
}
Expand Down

0 comments on commit 04b05f3

Please sign in to comment.