Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Boldizsar Mezei committed May 13, 2024
1 parent e5fb59c commit 99ad7d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions packages/database/src/pg/impl/postgres.ts
Original file line number Diff line number Diff line change
Expand Up @@ -624,9 +624,12 @@ export class PgRunTransaction implements ITransaction {
}
try {
return await docRef.useTransaction(this.trx, (doc) => doc.get());
} catch {
this.allLocksAquired = false;
return await docRef.get();
} catch (err: any) {
if (err.name === 'KnexTimeoutError') {
this.allLocksAquired = false;
return await docRef.get();
}
throw err;
}
};

Expand Down
2 changes: 1 addition & 1 deletion packages/database/src/pg/interfaces/document/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class IDocument<C, B extends BaseRecord, U extends Update> {
createQuery = () => {
let query = this.con(this.table).where(this.pKey);
if (this.con.isTransaction) {
query.forUpdate().noWait();
query.forUpdate().timeout(200);
}
return query;
};
Expand Down

0 comments on commit 99ad7d7

Please sign in to comment.