Skip to content

Commit 27102da

Browse files
committed
fix: use new this.sqlTransaction(...) in pox2 db queries
1 parent 026610e commit 27102da

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/datastore/pg-store.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1977,7 +1977,7 @@ export class PgStore {
19771977
limit: number;
19781978
offset: number;
19791979
}): Promise<DbPox2Event[]> {
1980-
return await this.sql.begin(async sql => {
1980+
return await this.sqlTransaction(async sql => {
19811981
const queryResults = await sql<Pox2EventQueryResult[]>`
19821982
SELECT ${sql(POX2_EVENT_COLUMNS)}
19831983
FROM pox2_events
@@ -1992,12 +1992,11 @@ export class PgStore {
19921992
}
19931993

19941994
async getPox2EventsForTx({ txId }: { txId: string }): Promise<FoundOrNot<DbPox2Event[]>> {
1995-
// TODO: this query should be performed in the same sql tx as the next
1996-
const dbTx = await this.getTx({ txId, includeUnanchored: true });
1997-
if (!dbTx.found) {
1998-
return { found: false };
1999-
}
2000-
return await this.sql.begin(async sql => {
1995+
return await this.sqlTransaction(async sql => {
1996+
const dbTx = await this.getTx({ txId, includeUnanchored: true });
1997+
if (!dbTx.found) {
1998+
return { found: false };
1999+
}
20012000
const queryResults = await sql<Pox2EventQueryResult[]>`
20022001
SELECT ${sql(POX2_EVENT_COLUMNS)}
20032002
FROM pox2_events
@@ -2014,7 +2013,7 @@ export class PgStore {
20142013
}: {
20152014
principal: string;
20162015
}): Promise<FoundOrNot<DbPox2Event[]>> {
2017-
return await this.sql.begin(async sql => {
2016+
return await this.sqlTransaction(async sql => {
20182017
const queryResults = await sql<Pox2EventQueryResult[]>`
20192018
SELECT ${sql(POX2_EVENT_COLUMNS)}
20202019
FROM pox2_events

0 commit comments

Comments
 (0)