mirror of
https://github.com/logos-storage/nim-ethers.git
synced 2026-01-05 23:23:08 +00:00
do not crash polling when just unsubscribed
This commit is contained in:
parent
c6a59b5187
commit
f15d55f513
@ -171,13 +171,11 @@ proc new*(_: type JsonRpcSubscriptions,
|
||||
discard
|
||||
|
||||
proc getChanges(id: JsonNode): Future[JsonNode] {.async: (raises: [CancelledError]).} =
|
||||
if mappedId =? subscriptions.subscriptionMapping.?[id]:
|
||||
try:
|
||||
let mappedId = subscriptions.subscriptionMapping[id]
|
||||
let changes = await subscriptions.client.eth_getFilterChanges(mappedId)
|
||||
if changes.kind == JArray:
|
||||
return changes
|
||||
except KeyError as error:
|
||||
raiseAssert "subscription mapping invalid: " & error.msg
|
||||
except JsonRpcError:
|
||||
await resubscribe(id)
|
||||
# TODO: we could still miss some events between losing the subscription
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user