multi: thread context through DeletePayments

This commit is contained in:
ziggie committed 2026-02-25 08:02:19 +01:00
1 parent bc15d4bb50
commit 563a2ac9d3
6 files changed
+19 -14

No files matched your search

+5 -5
View File
@@ -1874,13 +1874,13 @@ func (s *SQLStore) Fail(paymentHash lntypes.Hash,
// This method is part of the PaymentWriter interface, which is embedded in
// the DB interface.
//
// TODO(ziggie): batch this call instead in the background so for dbs with
// many payments it doesn't block the main thread.
func (s *SQLStore) DeletePayments(failedOnly, failedHtlcsOnly bool) (int,
error) {
// TODO(ziggie): batch and use iterator instead, moreover we dont need to fetch
// the complete payment data for each payment, we can just fetch the payment ID
// and the resolution types to decide if the payment is removable.
func (s *SQLStore) DeletePayments(ctx context.Context, failedOnly,
failedHtlcsOnly bool) (int, error) {
var numPayments int
ctx := context.TODO()
extractCursor := func(row sqlc.FilterPaymentsRow) int64 {
return row.Payment.ID