@@ -76,8 +76,8 @@ function reconnect(callback) {
|
||||
|
||||
gConnectionPool.getConnection(function (error, connection) {
|
||||
if (error) {
|
||||
console.error('Unable to reestablish connection to database. Try again in a bit.', error.message);
|
||||
return setTimeout(reconnect.bind(null, callback), 1000);
|
||||
console.error('Unable to reestablish connection to database. Try again in 10 seconds.', error.message);
|
||||
return setTimeout(reconnect.bind(null, callback), 10000);
|
||||
}
|
||||
|
||||
connection.on('error', function (error) {
|
||||
@@ -85,10 +85,10 @@ function reconnect(callback) {
|
||||
// this function should be invoked only when we have no callbacks pending and we have a fatal error
|
||||
assert(error.fatal, 'Non-fatal error on connection object');
|
||||
|
||||
console.error('Unhandled mysql connection error.', error);
|
||||
console.error('Unhandled mysql connection error. Will reconnect in 10 seconds', error);
|
||||
|
||||
// This is most likely an issue an can cause double callbacks from reconnect()
|
||||
setTimeout(reconnect.bind(null, callback), 1000);
|
||||
setTimeout(reconnect.bind(null, callback), 10000);
|
||||
});
|
||||
|
||||
gDefaultConnection = connection;
|
||||
|
||||
Reference in New Issue
Block a user