From 366f66a2e2eceeff5cd783d9cfc0303ea54f1fb2 Mon Sep 17 00:00:00 2001 From: kiwiidb Date: Sat, 22 Jan 2022 10:33:54 +0100 Subject: [PATCH] use bun.Tx to avoid db locked err --- lib/service/invoices.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/service/invoices.go b/lib/service/invoices.go index 67a6d47..33ddf23 100644 --- a/lib/service/invoices.go +++ b/lib/service/invoices.go @@ -72,7 +72,7 @@ func (svc *LndhubService) SendInternalPayment(tx *bun.Tx, invoice *models.Invoic incomingInvoice.Internal = true // mark incoming invoice as internal, just for documentation/debugging incomingInvoice.State = "settled" incomingInvoice.SettledAt = schema.NullTime{Time: time.Now()} - _, err = svc.DB.NewUpdate().Model(&incomingInvoice).WherePK().Exec(context.TODO()) + _, err = tx.NewUpdate().Model(&incomingInvoice).WherePK().Exec(context.TODO()) if err != nil { // could not save the invoice of the recipient return sendPaymentResponse, err