mirror of
https://github.com/status-im/nim-ethers.git
synced 2025-01-13 00:54:38 +00:00
Ignore errors while polling
This commit is contained in:
parent
50cfd9d9dd
commit
0322ae1451
@ -105,8 +105,14 @@ proc new*(_: type JsonRpcSubscriptions,
|
|||||||
|
|
||||||
let subscriptions = PollingSubscriptions(client: client)
|
let subscriptions = PollingSubscriptions(client: client)
|
||||||
|
|
||||||
|
proc getChanges(id: JsonNode): Future[JsonNode] {.async.} =
|
||||||
|
try:
|
||||||
|
return await subscriptions.client.eth_getFilterChanges(id)
|
||||||
|
except CatchableError:
|
||||||
|
return newJArray()
|
||||||
|
|
||||||
proc poll(id: JsonNode) {.async.} =
|
proc poll(id: JsonNode) {.async.} =
|
||||||
for change in await subscriptions.client.eth_getFilterChanges(id):
|
for change in await getChanges(id):
|
||||||
if callback =? subscriptions.getCallback(id):
|
if callback =? subscriptions.getCallback(id):
|
||||||
callback(id, change)
|
callback(id, change)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user