database: Fix event emitter warning
the connection object gets reused after release. this means that we keep attaching the 'error' event and not unlistening. --trace-warnings can be added to box.service to get the stack trace
This commit is contained in:
@@ -145,7 +145,9 @@ function rollback(connection, transactionError, callback) {
|
||||
connection.rollback(function (error) {
|
||||
if (error) debug('rollback: error when rolling back', error);
|
||||
|
||||
connection.removeAllListeners('error');
|
||||
connection.release();
|
||||
|
||||
callback(transactionError);
|
||||
});
|
||||
}
|
||||
@@ -169,7 +171,9 @@ function transaction(queries, callback) {
|
||||
connection.commit(function (error) {
|
||||
if (error) return rollback(connection, error, callback);
|
||||
|
||||
connection.removeAllListeners('error');
|
||||
connection.release();
|
||||
|
||||
callback(null, results);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user