Adjust deprecated use of sleepAsync

This commit is contained in:
kdeme 2019-06-11 15:31:00 +02:00
parent 9e29d2211f
commit 0966a4e9ca
No known key found for this signature in database
GPG Key ID: 4E8DD21420AF43F5
4 changed files with 7 additions and 7 deletions

View File

@ -111,7 +111,7 @@ proc connectToNetwork*(node: EthereumNode,
while node.peerPool.connectedNodes.len == 0:
trace "Waiting for more peers", peers = node.peerPool.connectedNodes.len
await sleepAsync(500)
await sleepAsync(500.milliseconds)
proc stopListening*(node: EthereumNode) =
node.listeningServer.stop()

View File

@ -8,7 +8,7 @@ import
const
lookupInterval = 5
connectLoopSleepMs = 2000
connectLoopSleep = chronos.milliseconds(2000)
proc newPeerPool*(network: EthereumNode,
networkId: uint, keyPair: KeyPair,
@ -179,7 +179,7 @@ proc run(p: PeerPool) {.async.} =
if dropConnections:
await p.stopAllPeers()
await sleepAsync(connectLoopSleepMs)
await sleepAsync(connectLoopSleep)
proc start*(p: PeerPool) =
if not p.running:

View File

@ -29,8 +29,8 @@ const
whisperVersionStr* = $whisperVersion
defaultMinPow* = 0.2'f64
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
pruneInterval* = 1000 ## Interval at which message queue is pruned, in ms
messageInterval* = chronos.milliseconds(300) ## Interval at which messages are send to peers, in ms
pruneInterval* = chronos.milliseconds(1000) ## Interval at which message queue is pruned, in ms
type
Hash* = MDigest[256]

View File

@ -18,7 +18,7 @@ proc resetMessageQueues(nodes: varargs[EthereumNode]) =
let bootENode = waitFor setupBootNode()
let safeTTL = 5'u32
let waitInterval = messageInterval + 150
let waitInterval = messageInterval + 150.milliseconds
var node1 = setupTestNode(Whisper)
var node2 = setupTestNode(Whisper)
@ -283,7 +283,7 @@ suite "Whisper connections":
await sleepAsync(waitInterval)
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 node2.protocolState(Whisper).queue.items.len == 0