Fix postgresql auto-reconnection

master
Vitaliy Filippov 2022-01-19 18:47:15 +03:00
parent bc475535d7
commit 60e821fc54
1 changed files with 5 additions and 4 deletions

View File

@ -1,6 +1,6 @@
// Простенький "селект билдер" по мотивам MediaWiki-овского, успешно юзаю подобный в PHP уже лет 8
// (c) Виталий Филиппов, 2019-2021
// Версия 2021-11-24
// (c) Виталий Филиппов, 2019-2022
// Версия 2022-01-19
// В PHP, правда, прикольнее - там в массиве можно смешивать строковые и численные ключи,
// благодаря чему можно писать $where = [ 't1.a=t2.a', 't2.b' => [ 1, 2, 3 ] ]
@ -796,13 +796,14 @@ class Connection extends ConnectionBase
this.in_transaction = null;
const next = this.transaction_queue.shift();
if (next)
next();
setImmediate(next);
}
async _query(sql, bind)
{
if (this.in_transaction && this.connection_lost)
if (this.in_transaction && this.in_transaction !== true && this.connection_lost)
{
this.connection_lost = false;
this._next_txn();
throw new Error('Connection lost while in transaction');
}