Wpis z mikrobloga

mysql co jakiś czas zrywa mi połączenie z #nodejs i wyrzuca PROTOCOLCONNECTIONLOST.
Co muszę zrobić żeby obsłuzyć ten błąd bo to mi nie pomaga ;/

function handleDBConnections() {
connection.connect();
};

handleDBConnections();
connection.on('error', function(err) {
console.log(new Date().toDateString()+' db error', err);
if(err.code === 'PROTOCOL_CONNECTION_LOST') { // Connection to the MySQL server is usually
//console.log('w if protocol_connection_lost', err.code);
connection.end();
handleDBConnections(); // lost due to either server restart, or a
} else { // connnection idle timeout (the wait_timeout
throw err; // server variable configures this)
}
});

#javascript