You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I made a cron command using ScheduleEveryOtherMinute trait, however the scheduler crashes every second time it tries to create the job with Warning: PDOStatement::execute(): MySQL server has gone away exception.
A possible fix for this would running something like this every loop iteration:
if ($em->getConnection()->ping() === false) {
$em->getConnection()->close();
$em->getConnection()->connect();
}
If I recall correctly, the EntityManager doesn't get closed if you disconnect/connect the underlying connection manually so the rest of code should work without any changes.
If every loop iteration seems excessive then perhaps an option like --conn-ping-interval which will allow to define a custom interval to run the code above.
Thoughts (I can make a PR)?
The text was updated successfully, but these errors were encountered:
I made a cron command using
ScheduleEveryOtherMinute
trait, however the scheduler crashes every second time it tries to create the job withWarning: PDOStatement::execute(): MySQL server has gone away
exception.A possible fix for this would running something like this every loop iteration:
If I recall correctly, the
EntityManager
doesn't get closed if you disconnect/connect the underlying connection manually so the rest of code should work without any changes.If every loop iteration seems excessive then perhaps an option like
--conn-ping-interval
which will allow to define a custom interval to run the code above.Thoughts (I can make a PR)?
The text was updated successfully, but these errors were encountered: