fix mysql server gone away and dead lock on table

This commit is contained in:
aynsix
2020-05-27 19:55:45 +03:00
parent c5f90e930e
commit 50f016ebb5
4 changed files with 50 additions and 18 deletions

View File

@@ -102,4 +102,12 @@ class WorkerRunningJobRepository extends EntityRepository
{
return parent::getEntityManager();
}
public function reconnect()
{
if($this->_em->getConnection()->ping() === false) {
$this->_em->getConnection()->close();
$this->_em->getConnection()->connect();
}
}
}