Use private realay enpoint (#97)

* feat: use private ws endpoint

* chore: bump `min_lnbits_version`

* fix: retry logic

* fix: restart logic

* chore: fux log message
This commit is contained in:
Vlad Stan 2024-01-22 13:50:40 +02:00 committed by GitHub
parent 55624cc2b5
commit 91e42ee686
4 changed files with 62 additions and 54 deletions

View file

@ -1,4 +1,7 @@
from asyncio import Queue
import asyncio
from loguru import logger
from lnbits.core.models import Payment
from lnbits.tasks import register_invoice_listener
@ -33,9 +36,13 @@ async def on_invoice_paid(payment: Payment) -> None:
async def wait_for_nostr_events(nostr_client: NostrClient):
await subscribe_to_all_merchants()
while True:
message = await nostr_client.get_event()
await process_nostr_message(message)
try:
await subscribe_to_all_merchants()
while True:
message = await nostr_client.get_event()
await process_nostr_message(message)
except Exception as e:
logger.warning(f"Subcription failed. Will retry in one minute: {e}")
await asyncio.sleep(10)