Код: Выделить всё
async transaction(done: (conn: this) => V): Promise {
this.depth += 1;
await this.execute(`SAVEPOINT tt_${this.depth}`);
try {
return await done(this);
} catch (err) {
await this.execute(`ROLLBACK TO tt_${this.depth}`);
throw err;
} finally {
await this.execute(`RELEASE tt_${this.depth}`);
this.depth -= 1;
}
}
Но вызовы на том же уровне не могут быть Сделано параллельно, например, < /p>
Код: Выделить всё
promise.all([
db.transaction(...),
db.transaction(...),
]);
Подробнее здесь: https://stackoverflow.com/questions/794 ... n-parallel