feat: add settings.lnbits_running (#2450)
* feat: add `settings.lnbits_runing `
This commit is contained in:
@@ -184,6 +184,6 @@ class AlbyWallet(Wallet):
|
||||
|
||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||
self.queue: asyncio.Queue = asyncio.Queue(0)
|
||||
while True:
|
||||
while settings.lnbits_running:
|
||||
value = await self.queue.get()
|
||||
yield value
|
||||
|
||||
@@ -166,10 +166,10 @@ class ClicheWallet(Wallet):
|
||||
)
|
||||
|
||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||
while True:
|
||||
while settings.lnbits_running:
|
||||
try:
|
||||
ws = create_connection(self.endpoint)
|
||||
while True:
|
||||
while settings.lnbits_running:
|
||||
r = ws.recv()
|
||||
data = json.loads(r)
|
||||
print(data)
|
||||
|
||||
@@ -232,7 +232,7 @@ class CoreLightningWallet(Wallet):
|
||||
return PaymentPendingStatus()
|
||||
|
||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||
while True:
|
||||
while settings.lnbits_running:
|
||||
try:
|
||||
paid = await run_sync(
|
||||
lambda: self.ln.waitanyinvoice(self.last_pay_index, timeout=2)
|
||||
|
||||
@@ -256,7 +256,7 @@ class CoreLightningRestWallet(Wallet):
|
||||
return PaymentPendingStatus()
|
||||
|
||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||
while True:
|
||||
while settings.lnbits_running:
|
||||
try:
|
||||
url = f"{self.url}/v1/invoice/waitAnyInvoice/{self.last_pay_index}"
|
||||
async with self.client.stream("GET", url, timeout=None) as r:
|
||||
|
||||
@@ -215,13 +215,13 @@ class EclairWallet(Wallet):
|
||||
return PaymentPendingStatus()
|
||||
|
||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||
while True:
|
||||
while settings.lnbits_running:
|
||||
try:
|
||||
async with connect(
|
||||
self.ws_url,
|
||||
extra_headers=[("Authorization", self.headers["Authorization"])],
|
||||
) as ws:
|
||||
while True:
|
||||
while settings.lnbits_running:
|
||||
message = await ws.recv()
|
||||
message_json = json.loads(message)
|
||||
|
||||
|
||||
@@ -133,6 +133,6 @@ class FakeWallet(Wallet):
|
||||
return PaymentPendingStatus()
|
||||
|
||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||
while True:
|
||||
while settings.lnbits_running:
|
||||
value: Bolt11 = await self.queue.get()
|
||||
yield value.payment_hash
|
||||
|
||||
@@ -155,7 +155,7 @@ class LNbitsWallet(Wallet):
|
||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||
url = f"{self.endpoint}/api/v1/payments/sse"
|
||||
|
||||
while True:
|
||||
while settings.lnbits_running:
|
||||
try:
|
||||
async with httpx.AsyncClient(
|
||||
timeout=None, headers=self.headers
|
||||
|
||||
@@ -268,7 +268,7 @@ class LndWallet(Wallet):
|
||||
return PaymentPendingStatus()
|
||||
|
||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||
while True:
|
||||
while settings.lnbits_running:
|
||||
try:
|
||||
request = ln.InvoiceSubscription()
|
||||
async for i in self.rpc.SubscribeInvoices(request):
|
||||
|
||||
@@ -280,7 +280,7 @@ class LndRestWallet(Wallet):
|
||||
return PaymentPendingStatus()
|
||||
|
||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||
while True:
|
||||
while settings.lnbits_running:
|
||||
try:
|
||||
url = "/v1/invoices/subscribe"
|
||||
async with self.client.stream("GET", url, timeout=None) as r:
|
||||
|
||||
@@ -145,6 +145,6 @@ class LNPayWallet(Wallet):
|
||||
|
||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||
self.queue: asyncio.Queue = asyncio.Queue(0)
|
||||
while True:
|
||||
while settings.lnbits_running:
|
||||
value = await self.queue.get()
|
||||
yield value
|
||||
|
||||
@@ -152,7 +152,7 @@ class LnTipsWallet(Wallet):
|
||||
|
||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||
last_connected = None
|
||||
while True:
|
||||
while settings.lnbits_running:
|
||||
url = "/api/v1/invoicestream"
|
||||
try:
|
||||
last_connected = time.time()
|
||||
|
||||
@@ -141,6 +141,6 @@ class OpenNodeWallet(Wallet):
|
||||
|
||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||
self.queue: asyncio.Queue = asyncio.Queue(0)
|
||||
while True:
|
||||
while settings.lnbits_running:
|
||||
value = await self.queue.get()
|
||||
yield value
|
||||
|
||||
@@ -244,7 +244,7 @@ class SparkWallet(Wallet):
|
||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||
url = f"/stream?access-key={self.token}"
|
||||
|
||||
while True:
|
||||
while settings.lnbits_running:
|
||||
try:
|
||||
async with self.client.stream("GET", url, timeout=None) as r:
|
||||
async for line in r.aiter_lines():
|
||||
|
||||
@@ -154,6 +154,6 @@ class ZBDWallet(Wallet):
|
||||
|
||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||
self.queue: asyncio.Queue = asyncio.Queue(0)
|
||||
while True:
|
||||
while settings.lnbits_running:
|
||||
value = await self.queue.get()
|
||||
yield value
|
||||
|
||||
Reference in New Issue
Block a user