Release memory when unsubscribe fails

Ensures that even when a call to the ethereum node to
unsubscribe fails, it will release the memory associated
with the subscription, including the subscription handler
closure.
This commit is contained in:
Mark Spanbroek 2022-05-17 19:10:58 +02:00 committed by markspanbroek
parent bbf133725f
commit fc0d5c4121
1 changed files with 1 additions and 1 deletions

View File

@ -158,9 +158,9 @@ method subscribe*(provider: JsonRpcProvider,
method unsubscribe*(subscription: JsonRpcSubscription) {.async.} =
let provider = subscription.provider
provider.subscriptions.del(subscription.id)
let client = await provider.client
discard await client.eth_unsubscribe(subscription.id)
provider.subscriptions.del(subscription.id)
# Signer