From 57bf95747dc20fecfbaee1a3e85a1284666c483c Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Tue, 19 Jun 2018 21:12:21 +1000 Subject: [PATCH] * LDV : database connection keepalive --- lib/LDV.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/LDV.pm b/lib/LDV.pm index 406bb06..f037f2f 100644 --- a/lib/LDV.pm +++ b/lib/LDV.pm @@ -41,6 +41,11 @@ sub startup { $db->connect; return $db; }); + my $loop = Mojo::IOLoop->singleton; + $loop->recurring(60 => sub { + $self->app->db->ping; + $self->app->log->debug("db ping, process $$"); + }); my $r = $self->routes;