Make format
This commit is contained in:
parent
940ef26003
commit
c6b72f7f47
1 changed files with 14 additions and 4 deletions
|
|
@ -118,7 +118,17 @@ class ClicheWallet(Wallet):
|
||||||
return PaymentStatus(statuses[data["result"]["status"]])
|
return PaymentStatus(statuses[data["result"]["status"]])
|
||||||
|
|
||||||
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
async def paid_invoices_stream(self) -> AsyncGenerator[str, None]:
|
||||||
self.queue: asyncio.Queue = asyncio.Queue(0)
|
try:
|
||||||
while True:
|
ws = await create_connection(self.endpoint)
|
||||||
value = await self.queue.get()
|
while True:
|
||||||
yield value
|
r = await ws.recv()
|
||||||
|
data = json.loads(r)
|
||||||
|
try:
|
||||||
|
if data["result"]["status"]:
|
||||||
|
yield data["result"]["payment_hash"]
|
||||||
|
except:
|
||||||
|
continue
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
logger.error("lost connection to cliche's websocket, retrying in 5 seconds")
|
||||||
|
await asyncio.sleep(5)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue