Error while sending QUERY packet in Lumen queue
I'm calling a common function from Lumen queue and cron job. During user interaction this function is called from queue ( async purpose ), if something goes wrong with queue execution for example lock wait timeout etc. I have a cron job which is scheduled for every 15 mins to process older transactions. There is no issue when cron is executed but whenever queue is executed MySQL server has gone away error is occurring. Error is occurring at the line DB::connection()->getpdo()->exec('BEGIN');
public function processTransaction($data)
{
try {
$this->validate($data);
DB::connection()->getpdo()->exec('BEGIN');
// Save & Update DB
DB::connection()->getpdo()->exec('COMMIT');
} catch (Exception $ex) {
DB::connection()->getpdo()->exec('ROLLBACK');
Log::error($ex->getMessage() . '-' . $ex->getTraceAsString());
throw new AppException($ex->getMessage(), $ex->getCode());
}
}
Error is
Error while sending QUERY packet. PID=28968-#0 [internal function]: Laravel\Lumen\Application->Laravel\Lumen\Concerns{closure}(2, 'Error while sen...', '/web-user/....', 164, Array) PDO->exec('BEGIN')
Lumen version is 5.7
Please or to participate in this conversation.