mirror of https://github.com/status-im/nim-eth.git
Adjust deprecated use of sleepAsync
This commit is contained in:
parent
9e29d2211f
commit
0966a4e9ca
|
@ -111,7 +111,7 @@ proc connectToNetwork*(node: EthereumNode,
|
||||||
|
|
||||||
while node.peerPool.connectedNodes.len == 0:
|
while node.peerPool.connectedNodes.len == 0:
|
||||||
trace "Waiting for more peers", peers = node.peerPool.connectedNodes.len
|
trace "Waiting for more peers", peers = node.peerPool.connectedNodes.len
|
||||||
await sleepAsync(500)
|
await sleepAsync(500.milliseconds)
|
||||||
|
|
||||||
proc stopListening*(node: EthereumNode) =
|
proc stopListening*(node: EthereumNode) =
|
||||||
node.listeningServer.stop()
|
node.listeningServer.stop()
|
||||||
|
|
|
@ -8,7 +8,7 @@ import
|
||||||
|
|
||||||
const
|
const
|
||||||
lookupInterval = 5
|
lookupInterval = 5
|
||||||
connectLoopSleepMs = 2000
|
connectLoopSleep = chronos.milliseconds(2000)
|
||||||
|
|
||||||
proc newPeerPool*(network: EthereumNode,
|
proc newPeerPool*(network: EthereumNode,
|
||||||
networkId: uint, keyPair: KeyPair,
|
networkId: uint, keyPair: KeyPair,
|
||||||
|
@ -179,7 +179,7 @@ proc run(p: PeerPool) {.async.} =
|
||||||
if dropConnections:
|
if dropConnections:
|
||||||
await p.stopAllPeers()
|
await p.stopAllPeers()
|
||||||
|
|
||||||
await sleepAsync(connectLoopSleepMs)
|
await sleepAsync(connectLoopSleep)
|
||||||
|
|
||||||
proc start*(p: PeerPool) =
|
proc start*(p: PeerPool) =
|
||||||
if not p.running:
|
if not p.running:
|
||||||
|
|
|
@ -29,8 +29,8 @@ const
|
||||||
whisperVersionStr* = $whisperVersion
|
whisperVersionStr* = $whisperVersion
|
||||||
defaultMinPow* = 0.2'f64
|
defaultMinPow* = 0.2'f64
|
||||||
defaultMaxMsgSize* = 1024'u32 * 1024'u32 # * 10 # should be no higher than max RLPx size
|
defaultMaxMsgSize* = 1024'u32 * 1024'u32 # * 10 # should be no higher than max RLPx size
|
||||||
messageInterval* = 300 ## Interval at which messages are send to peers, in ms
|
messageInterval* = chronos.milliseconds(300) ## Interval at which messages are send to peers, in ms
|
||||||
pruneInterval* = 1000 ## Interval at which message queue is pruned, in ms
|
pruneInterval* = chronos.milliseconds(1000) ## Interval at which message queue is pruned, in ms
|
||||||
|
|
||||||
type
|
type
|
||||||
Hash* = MDigest[256]
|
Hash* = MDigest[256]
|
||||||
|
|
|
@ -18,7 +18,7 @@ proc resetMessageQueues(nodes: varargs[EthereumNode]) =
|
||||||
|
|
||||||
let bootENode = waitFor setupBootNode()
|
let bootENode = waitFor setupBootNode()
|
||||||
let safeTTL = 5'u32
|
let safeTTL = 5'u32
|
||||||
let waitInterval = messageInterval + 150
|
let waitInterval = messageInterval + 150.milliseconds
|
||||||
|
|
||||||
var node1 = setupTestNode(Whisper)
|
var node1 = setupTestNode(Whisper)
|
||||||
var node2 = setupTestNode(Whisper)
|
var node2 = setupTestNode(Whisper)
|
||||||
|
@ -283,7 +283,7 @@ suite "Whisper connections":
|
||||||
await sleepAsync(waitInterval)
|
await sleepAsync(waitInterval)
|
||||||
check node1.protocolState(Whisper).queue.items.len == 10
|
check node1.protocolState(Whisper).queue.items.len == 10
|
||||||
|
|
||||||
await sleepAsync(int((lowerTTL+1)*1000))
|
await sleepAsync(milliseconds((lowerTTL+1)*1000))
|
||||||
check node1.protocolState(Whisper).queue.items.len == 0
|
check node1.protocolState(Whisper).queue.items.len == 0
|
||||||
check node2.protocolState(Whisper).queue.items.len == 0
|
check node2.protocolState(Whisper).queue.items.len == 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue