Fix status rpc request to use RESP_TIMEOUT. (#2002)
This commit is contained in:
parent
754d65c159
commit
e035b7d0c9
|
@ -1,7 +1,7 @@
|
||||||
import
|
import
|
||||||
options, tables, sets, macros,
|
options, tables, sets, macros,
|
||||||
chronicles, chronos, stew/ranges/bitranges, libp2p/switch,
|
chronicles, chronos, stew/ranges/bitranges, libp2p/switch,
|
||||||
spec/[datatypes, crypto, digest],
|
spec/[datatypes, network, crypto, digest],
|
||||||
beacon_node_types, eth2_network,
|
beacon_node_types, eth2_network,
|
||||||
block_pools/chain_dag
|
block_pools/chain_dag
|
||||||
|
|
||||||
|
@ -107,9 +107,7 @@ p2pProtocol BeaconSync(version = 1,
|
||||||
# given incoming flag
|
# given incoming flag
|
||||||
let
|
let
|
||||||
ourStatus = peer.networkState.getCurrentStatus()
|
ourStatus = peer.networkState.getCurrentStatus()
|
||||||
# TODO: The timeout here is so high only because we fail to
|
theirStatus = await peer.status(ourStatus, timeout = RESP_TIMEOUT)
|
||||||
# respond in time due to high CPU load in our single thread.
|
|
||||||
theirStatus = await peer.status(ourStatus, timeout = 60.seconds)
|
|
||||||
|
|
||||||
if theirStatus.isOk:
|
if theirStatus.isOk:
|
||||||
await peer.handleStatus(peer.networkState,
|
await peer.handleStatus(peer.networkState,
|
||||||
|
@ -217,8 +215,7 @@ proc updateStatus*(peer: Peer): Future[bool] {.async.} =
|
||||||
nstate = peer.networkState(BeaconSync)
|
nstate = peer.networkState(BeaconSync)
|
||||||
ourStatus = getCurrentStatus(nstate)
|
ourStatus = getCurrentStatus(nstate)
|
||||||
|
|
||||||
let theirFut = awaitne peer.status(ourStatus,
|
let theirFut = awaitne peer.status(ourStatus, timeout = RESP_TIMEOUT)
|
||||||
timeout = chronos.seconds(60))
|
|
||||||
if theirFut.failed():
|
if theirFut.failed():
|
||||||
return false
|
return false
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue