Open azlankenali opened 3 years ago
The MySQL server has gone away
error is common. It likely means that the connection has been sitting idle too long and the server dropped the connection. What does $app->dbhWorker
return? The Mojo::mysql object should be automatically reconnecting if the server goes away.
Hi,
I got error below when load test application. Can assists me on this
DBD::mysql::st execute failed: MySQL server has gone away at /usr/lib/perl5/site_perl/5.26.1/Minion/Backend/mysql.pm line 590.
Im using mojo full app with below code sample.
Register minion plugin using cache db connection
$app->plugin( Minion => { mysql => $app->dbhWorker } );
Register worker
$app->plugin('Worker::Task::Job');
package Worker::Task::Job;
use Mojo::Base 'Mojolicious::Plugin'; use Mojo::JSON qw( encode_json decode_json );
sub register { my($self,$app) = @_;
$app->log->info("Registering Worker plugin");
Register worker task
$app->minion->add_task(storechat => sub { my($job,$json) = @; my $sub = "store_chat"; $job->app->log->info("($sub) storing chat: [$json]"); $job->finish; $job->remove; }); }