fix improper `yield` usage in `el_manager` (#5789)
`yield` is not supported in `{.async.}`. Replace with alternative that does not leak.
This commit is contained in:
parent
b2c49603ae
commit
d6e55ca3d8
|
@ -583,17 +583,14 @@ proc newWeb3*(engineUrl: EngineApiUrl): Future[Web3] =
|
||||||
|
|
||||||
proc establishEngineApiConnection*(url: EngineApiUrl):
|
proc establishEngineApiConnection*(url: EngineApiUrl):
|
||||||
Future[Result[Web3, string]] {.async.} =
|
Future[Result[Web3, string]] {.async.} =
|
||||||
let web3Fut = newWeb3(url)
|
try:
|
||||||
yield web3Fut or sleepAsync(engineApiConnectionTimeout)
|
ok(await newWeb3(url).wait(engineApiConnectionTimeout))
|
||||||
|
except AsyncTimeoutError:
|
||||||
if not web3Fut.completed:
|
err "Engine API connection timed out"
|
||||||
await cancelAndWait(web3Fut)
|
except CancelledError as exc:
|
||||||
if web3Fut.failed:
|
raise exc
|
||||||
return err "Failed to setup Engine API connection: " & web3Fut.readError.msg
|
except CatchableError as exc:
|
||||||
else:
|
err "Engine API connection failed: " & exc.msg
|
||||||
return err "Failed to setup Engine API connection"
|
|
||||||
else:
|
|
||||||
return ok web3Fut.read
|
|
||||||
|
|
||||||
proc tryConnecting(connection: ELConnection): Future[bool] {.async.} =
|
proc tryConnecting(connection: ELConnection): Future[bool] {.async.} =
|
||||||
if connection.isConnected:
|
if connection.isConnected:
|
||||||
|
|
Loading…
Reference in New Issue