Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let isRun = true;
- let count = 0;
- async function dbTransactionTest() {
- await connection.promise().beginTransaction();
- try {
- await connection.promise().query(`INSERT INTO test (gameId, serverId) VALUES ('1', '1');`);
- await connection.promise().commit();
- count++;
- } catch (error) {
- await connection.promise().rollback();
- throw error;
- }
- };
- function test() {
- setTimeout(() => {
- isRun = false;
- console.log(count);
- }, 1000);
- while (isRun) {
- dbTransactionTest();
- }
- };
- test();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement