Skip to content

Commit

Permalink
fix catching pending subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
droserasprout committed Dec 23, 2024
1 parent 63f87fc commit 2665096
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/dipdup/datasources/substrate_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,17 +194,17 @@ async def _on_message(self, message: Message) -> None:
# NOTE: Save subscription id
if self._pending_subscription:
self._subscription_ids[data['result']] = self._pending_subscription
self._requests[data['id']] = (self._requests[data['id']][0], data)
self._requests[data['id']][0].set()

# NOTE: Possibly unreliable logic from evm_node, and possibly too time consuming for message handling
level = await self.get_head_level()
self._subscriptions.set_sync_level(self._pending_subscription, level)

# NOTE: Set None to identify possible subscriptions conflicts
self._pending_subscription = None
else:
raise FrameworkException('id in data, but no pending subscription')

self._requests[data['id']] = (self._requests[data['id']][0], data)
self._requests[data['id']][0].set()

elif 'method' in data and data['method'].startswith('chain_'):
subscription_id = data['params']['subscription']
if subscription_id not in self._subscription_ids:
Expand Down

0 comments on commit 2665096

Please sign in to comment.