We should do all subsequent SQL operation within the same connection. If we don't do it, the transaction will wait of the operation to complete, and operation will wait for transaction to complete.
Bad:
await db.beginTransaction();
await dbpool.query(q); // does not use the db, so the operation might stuck
Good:
await db.beginTransaction();
await dbpool.queryWithConn(db, sql);; // uses the db, so the operation is safe
And also places where transaction might start but never be commited.
Or places where transaction is commited more than 1 time
Describe the bug When we use
We should do all subsequent SQL operation within the same connection. If we don't do it, the transaction will wait of the operation to complete, and operation will wait for transaction to complete. Bad:
Good:
And also places where transaction might start but never be commited. Or places where transaction is commited more than 1 time
Context