Skip to content

Commit

Permalink
Merge pull request #610 from permitio/rk/revert-broadcast-conn-failur…
Browse files Browse the repository at this point in the history
…e-handling

Revert "BasePolicyWatcherTask: Signal stop if broadcaster fails to connect"
  • Loading branch information
roekatz committed Jul 10, 2024
2 parents 94f9874 + c3cf66b commit b3d4625
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions packages/opal-server/opal_server/policy/watcher/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,11 @@ async def _subscribe_internal():
)

if self._pubsub_endpoint.broadcaster is not None:
try:
async with self._pubsub_endpoint.broadcaster.get_listening_context():
await _subscribe_internal()
await self._pubsub_endpoint.broadcaster.get_reader_task()
finally:
# Stop the watcher if broadcaster disconnects / fails to connect
async with self._pubsub_endpoint.broadcaster.get_listening_context():
await _subscribe_internal()
await self._pubsub_endpoint.broadcaster.get_reader_task()

# Stop the watcher if broadcaster disconnects
self.signal_stop()
else:
# If no broadcaster is configured, just subscribe, no need to wait on anything
Expand Down
2 changes: 1 addition & 1 deletion packages/requires.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
idna>=3.3,<4
typer>=0.4.1,<1
fastapi>=0.109.1,<1
fastapi_websocket_pubsub==0.3.9
fastapi_websocket_pubsub==0.3.7
fastapi_websocket_rpc>=0.1.21,<1
gunicorn>=22.0.0,<23
pydantic[email]>=1.9.1,<2
Expand Down

0 comments on commit b3d4625

Please sign in to comment.