Skip to content

Commit

Permalink
fix payment-listener: await paymentNotify and paymentWrite queue
Browse files Browse the repository at this point in the history
  • Loading branch information
anarkrypto committed Oct 8, 2024
1 parent fd3ec04 commit 5ec5851
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/durable/payment-listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ export class PaymentListener extends DurableObject<Env> {

payments.push(newPayment);

this.paymentNotify(newPayment, invoice.id);
this.paymentWrite(newPayment, invoice, service, webhooks);
await this.paymentNotify(newPayment, invoice.id);
await this.paymentWrite(newPayment, invoice, service, webhooks);

const paid_total = payments.reduce((acc, payment) => {
return acc + payment.amount;
Expand All @@ -133,7 +133,7 @@ export class PaymentListener extends DurableObject<Env> {

private async paymentWrite(payment: Payment, invoice: Invoice, service: Service, webhooks: Webhook[]) {
// Send the payment to the worker write to the db
this.env.PAYMENT_WRITE_QUEUE.send({
await this.env.PAYMENT_WRITE_QUEUE.send({
invoice,
service,
webhooks,
Expand Down

0 comments on commit 5ec5851

Please sign in to comment.