Closed Prumeth-shen closed 7 years ago
here is my code, I have tested it more than once
const connection = await mysql.createConnection({ host: host, user: user, password: password, database: database }); try { await connection.beginTransaction(); await connection.query('UPDATE account SET vip_start_time = 11111, vip_end_time = 11111 WHERE user_id = 44'); await connection.query('INSERT INTO notification SET type = ?, user_id = ?, content = ?, is_read = ?, created_at = ?', ['1', 44, 'aaa', 0, Math.floor(new Date() / 1000)]); } catch (err) { return connection.rollback(); }
the err stack is about this
{ [Error: ER_LOCK_WAIT_TIMEOUT: Lock wait timeout exceeded; try restarting transaction] code: 'ER_LOCK_WAIT_TIMEOUT', errno: 1205, sqlState: 'HY000', index: 0 }
And I find this the first query did not work at all
You've closed the issue so I'm assuming you've sorted it, but the error is a mysql error and not related to this library.
here is my code, I have tested it more than once
the err stack is about this
And I find this the first query did not work at all