Fixed a bunch of MySQL pooling issues where connections were not properly released or were double-released

This commit is contained in:
Andris Reinman 2016-04-05 15:29:42 +03:00
parent 06d2712916
commit 0392473ecd
8 changed files with 10 additions and 13 deletions

View file

@ -328,11 +328,11 @@ function addCustomField(listId, name, defaultValue, type, group, visible, callba
}
connection.query(query, err => {
connection.release();
if (err) {
connection.query('DELETE FROM custom_fields WHERE id=? LIMIT 1', [fieldId], () => false);
connection.query('DELETE FROM custom_fields WHERE id=? LIMIT 1', [fieldId], () => connection.release());
return callback(err);
}
connection.release();
return callback(null, fieldId);
});
});