refactor(execute): execute queries after first tick

Force queries to wait until the server has ticked before sending anything.
This commit is contained in:
Linden committed 2021-12-10 11:18:15 +11:00
1 parent cd2e73953f
commit 193da3e6c7
2 files changed
+24 -12

No files matched your search

+1 -11
View File
@@ -1,16 +1,6 @@
import { pool } from './pool';
import { execute, preparedStatement } from './execute';
import { transaction } from './transaction';
import { debug, isolationLevel } from './config';
setImmediate(async () => {
try {
await pool.query(isolationLevel);
console.log(`^2Database server connection established!^0`);
} catch (error) {
console.log(`^3Unable to establish a connection to the database! [${error.code}]\n${error.message}^0`);
}
});
import { debug } from './config';
const safeCallback = (callback, result) => {
if (typeof callback === 'function') callback(result);