mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-31 10:31: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
|
pass
|
||||||
|
|
||||||
status = lnd_response_state_to_lnpayment_status[response.state]
|
status = lnd_response_state_to_lnpayment_status[response.state]
|
||||||
lnpayment.status = status
|
|
||||||
lnpayment.save()
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# If it fails at finding the invoice: it has been canceled.
|
# 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):
|
if "unable to locate invoice" in str(e):
|
||||||
print(str(e))
|
print(str(e))
|
||||||
status = LNPayment.Status.CANCEL
|
status = LNPayment.Status.CANCEL
|
||||||
lnpayment.status = status
|
|
||||||
lnpayment.save()
|
|
||||||
|
|
||||||
# LND restarted.
|
# LND restarted.
|
||||||
if "wallet locked, unlock it" in str(e):
|
if "wallet locked, unlock it" in str(e):
|
||||||
|
@ -59,16 +59,16 @@ class Command(BaseCommand):
|
|||||||
at_least_one_changed = False
|
at_least_one_changed = False
|
||||||
|
|
||||||
for idx, hold_lnpayment in enumerate(queryset):
|
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 = LNNode.lookup_invoice_status(hold_lnpayment)
|
||||||
new_status = LNPayment.Status(status).label
|
|
||||||
|
|
||||||
# Only save the hold_payments that change (otherwise this function does not scale)
|
# Only save the hold_payments that change (otherwise this function does not scale)
|
||||||
changed = not old_status == new_status
|
changed = not old_status == new_status
|
||||||
if changed:
|
if changed:
|
||||||
# self.handle_status_change(hold_lnpayment, old_status)
|
# self.handle_status_change(hold_lnpayment, old_status)
|
||||||
self.update_order_status(hold_lnpayment)
|
self.update_order_status(hold_lnpayment)
|
||||||
|
hold_lnpayment.status = new_status
|
||||||
hold_lnpayment.save()
|
hold_lnpayment.save()
|
||||||
|
|
||||||
# Report for debugging
|
# Report for debugging
|
||||||
|
Loading…
Reference in New Issue
Block a user