nim-raft/tests/basic_timers.nim

18 lines
591 B
Nim
Raw Normal View History

# nim-raft
# Copyright (c) 2023 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
# at your option.
# This file may not be copied, modified, or distributed except according to
# those terms.
2023-09-01 01:00:39 +03:00
import ../raft/raft_api
2023-09-03 00:16:26 +03:00
export raft_api
2023-09-06 19:18:02 +03:00
proc RaftTimerCreateCustomImpl*(timerInterval: int, timerCallback: RaftTimerCallback): Future[void] {.async, nimcall, gcsafe.} =
var f = sleepAsync(milliseconds(timerInterval))
2023-09-06 19:18:02 +03:00
await f
if not f.cancelled:
timerCallback()