Skip to content

Commit

Permalink
fix: class var
Browse files Browse the repository at this point in the history
  • Loading branch information
motorina0 committed Oct 31, 2024
1 parent fd4f1e6 commit abcc435
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions router.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import asyncio
import json
from typing import Dict, List
from typing import ClassVar, Dict, List

from fastapi import WebSocket, WebSocketDisconnect
from lnbits.helpers import urlsafe_short_hash
Expand All @@ -16,9 +16,11 @@


class NostrRouter:
received_subscription_events: dict[str, List[EventMessage]]
received_subscription_notices: list[NoticeMessage]
received_subscription_eosenotices: dict[str, EndOfStoredEventsMessage]
received_subscription_events: ClassVar[dict[str, List[EventMessage]]] = {}
received_subscription_notices: ClassVar[list[NoticeMessage]] = []
received_subscription_eosenotices: ClassVar[dict[str, EndOfStoredEventsMessage]] = (
{}
)

def __init__(self, websocket: WebSocket):
self.connected: bool = True
Expand Down Expand Up @@ -75,6 +77,7 @@ async def _nostr_to_client(self):
self._handle_notices()
except Exception as e:
logger.debug(f"Failed to handle response for client: '{e!s}'.")
await asyncio.sleep(1)
await asyncio.sleep(0.1)

async def _handle_subscriptions(self):
Expand Down

0 comments on commit abcc435

Please sign in to comment.