refactor: use while settings.lnbits_running instead of while True
This commit is contained in:
parent
ba0f7a01ef
commit
9aa2194d94
3 changed files with 5 additions and 3 deletions
|
|
@ -7,6 +7,8 @@ from typing import TYPE_CHECKING, NamedTuple
|
|||
|
||||
from loguru import logger
|
||||
|
||||
from lnbits.settings import settings
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from lnbits.nodes.base import Node
|
||||
|
||||
|
|
@ -139,7 +141,7 @@ class Wallet(ABC):
|
|||
pass
|
||||
|
||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||
while True:
|
||||
while settings.lnbits_running:
|
||||
for invoice in self.pending_invoices:
|
||||
try:
|
||||
status = await self.get_invoice_status(invoice)
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ class BoltzWallet(Wallet):
|
|||
return PaymentFailedStatus()
|
||||
|
||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||
while True:
|
||||
while settings.lnbits_running:
|
||||
try:
|
||||
request = boltzrpc_pb2.GetSwapInfoRequest()
|
||||
info: boltzrpc_pb2.GetSwapInfoResponse
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ else:
|
|||
return PaymentPendingStatus()
|
||||
|
||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||
while True:
|
||||
while settings.lnbits_running:
|
||||
event = await breez_event_queue.get()
|
||||
if event.is_invoice_paid():
|
||||
yield event.details.payment_hash
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue