diff --git a/silverback/runner.py b/silverback/runner.py index 648eecb3..ed92c49a 100644 --- a/silverback/runner.py +++ b/silverback/runner.py @@ -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 ): @@ -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