Skip to content

Commit

Permalink
fix: sync transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed May 4, 2024
1 parent 1eb6206 commit 06ed571
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/graphql/src/application/uc/AddTransactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Input = SyncTransactionEvent[];

export class AddTransactions {
async execute(input: Input) {
await Promise.all(input.map((event) => this.syncTransaction(event)));
await Promise.all(input.map(this.syncTransaction.bind(this)));
}

private async syncTransaction({
Expand Down Expand Up @@ -137,15 +137,13 @@ export class AddTransactions {
export const addTransactions = async (data: Input) => {
await db.connect();
try {
const { execute } = new AddTransactions();
await execute(data);
const instance = new AddTransactions();
await instance.execute(data);
} catch (error) {
console.error(error);
throw new Error('Sync transactions', {
cause: error,
});
} finally {
await db.close();
}
};

Expand Down

0 comments on commit 06ed571

Please sign in to comment.