diff --git a/fastapi_websocket_pubsub/event_broadcaster.py b/fastapi_websocket_pubsub/event_broadcaster.py index 8e897e0..b3189e6 100644 --- a/fastapi_websocket_pubsub/event_broadcaster.py +++ b/fastapi_websocket_pubsub/event_broadcaster.py @@ -133,7 +133,7 @@ def __init__(self, broadcast_url: str, notifier: EventNotifier, channel="EventNo # The internal events notifier self._notifier = notifier self._is_publish_only = is_publish_only - self._publish_lock = asyncio.Lock() + self._publish_lock = None # used to track creation / removal of resources needed per type (reader task->listen, and subscription to internal events->share) self._listen_count: int = 0 self._share_count: int = 0 @@ -159,6 +159,10 @@ async def __broadcast_notifications__(self, subscription: Subscription, data): await self._sharing_broadcast_channel.publish(self._channel, note.json()) def _acquire_sharing_broadcast_channel(self): + """ + Initialize the elements needed for sharing events with the broadcast channel + """ + self._publish_lock = asyncio.Lock() self._sharing_broadcast_channel = self._broadcast_type(self._broadcast_url) async def _subscribe_to_all_topics(self): diff --git a/setup.py b/setup.py index 81a1831..fcc8857 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ def get_requirements(env=""): setup( name='fastapi_websocket_pubsub', - version='0.1.17', + version='0.1.18', author='Or Weis', author_email="or@authorizon.com", description="A fast and durable PubSub channel over Websockets (using fastapi-websockets-rpc).",