update are working perfectly.
However, when I go to mysql and SHOW PROCESSLIST;
I see that there are 15 open connections, which are closed over time. Each MySQL request opens a mysql connection.
What did I do wrong? I've searched everywhere and can't find a solution.
$app->helper('myDB' => sub { my $self = shift;
state $mysql = Mojo::mysql->new(
sprintf("mysql://%s:%s@%s/%s?charset=utf8mb4", 'root',
'voce123', 'localhost',
'mojoBase') );
$mysql->strict_mode(1);
$mysql = $mysql->close_idle_connections(1); $mysql->max_connections;
$mysql = $mysql->max_connections(3);
my $db = $mysql->db;
if ($db->dbh->ping) { $self->log->info("BD Connection Existing!");
} else { $self->log->info("BD Reconnecting...");
$mysql->new; }
return $db;
});
One process over morbo?
Обсуждают сегодня