Skip to content

Commit

Permalink
fix: unsubscribe from sub queue on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
fubuloubu committed Nov 13, 2023
1 parent c6b632b commit 338717f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions silverback/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ async def _block_task(self, block_handler: AsyncTaskiqDecoratedTask):
result = await block_task.wait_result()
self._handle_result(result)

await self.subscriptions.unsubscribe(sub_id)

async def _event_task(
self, contract_event: ContractEvent, event_handler: AsyncTaskiqDecoratedTask
):
Expand All @@ -124,6 +126,8 @@ async def _event_task(
result = await event_task.wait_result()
self._handle_result(result)

await self.subscriptions.unsubscribe(sub_id)

async def run(self):
async with Web3SubscriptionsManager(self.ws_uri) as subscriptions:
self.subscriptions = subscriptions
Expand Down

0 comments on commit 338717f

Please sign in to comment.