fix: catch sse exceptions (#1971)

This commit is contained in:
jackstar12 2023-09-27 11:25:42 +02:00 committed by GitHub
parent 2971b571bc
commit 5c5dd98af2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -478,8 +478,10 @@ async def subscribe_wallet_invoices(request: Request, wallet: Wallet):
yield dict(data=payment.json(), event="payment-received")
except asyncio.CancelledError:
logger.debug(f"removing listener for wallet {uid}")
except Exception as exc:
logger.error(f"Error in sse: {exc}")
finally:
api_invoice_listeners.pop(uid)
return
@api_router.get("/api/v1/payments/sse")