mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-18 12:11:35 +00:00
Optimize follow-invoices service performance (#480)
This commit is contained in:
parent
fcd6e25073
commit
c693faacde
@ -288,8 +288,6 @@ class LNNode:
|
||||
pass
|
||||
|
||||
status = lnd_response_state_to_lnpayment_status[response.state]
|
||||
lnpayment.status = status
|
||||
lnpayment.save()
|
||||
|
||||
except Exception as e:
|
||||
# If it fails at finding the invoice: it has been canceled.
|
||||
@ -297,8 +295,6 @@ class LNNode:
|
||||
if "unable to locate invoice" in str(e):
|
||||
print(str(e))
|
||||
status = LNPayment.Status.CANCEL
|
||||
lnpayment.status = status
|
||||
lnpayment.save()
|
||||
|
||||
# LND restarted.
|
||||
if "wallet locked, unlock it" in str(e):
|
||||
|
@ -59,16 +59,16 @@ class Command(BaseCommand):
|
||||
at_least_one_changed = False
|
||||
|
||||
for idx, hold_lnpayment in enumerate(queryset):
|
||||
old_status = LNPayment.Status(hold_lnpayment.status).label
|
||||
old_status = hold_lnpayment.status
|
||||
|
||||
status = LNNode.lookup_invoice_status(hold_lnpayment)
|
||||
new_status = LNPayment.Status(status).label
|
||||
new_status = LNNode.lookup_invoice_status(hold_lnpayment)
|
||||
|
||||
# Only save the hold_payments that change (otherwise this function does not scale)
|
||||
changed = not old_status == new_status
|
||||
if changed:
|
||||
# self.handle_status_change(hold_lnpayment, old_status)
|
||||
self.update_order_status(hold_lnpayment)
|
||||
hold_lnpayment.status = new_status
|
||||
hold_lnpayment.save()
|
||||
|
||||
# Report for debugging
|
||||
|
Loading…
Reference in New Issue
Block a user