refactor: use while settings.lnbits_running instead of while True

This commit is contained in:
Vlad Stan 2025-07-03 12:04:46 +03:00 committed by dni ⚡
parent ba0f7a01ef
commit 9aa2194d94
No known key found for this signature in database
GPG key ID: D1F416F29AD26E87
3 changed files with 5 additions and 3 deletions

View file

@ -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)

View file

@ -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

View file

@ -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