2023-08-22 01:04:47 +00:00
|
|
|
# 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-08-31 22:00:39 +00:00
|
|
|
import ../raft/raft_api
|
2023-08-22 01:04:47 +00:00
|
|
|
|
2023-09-02 21:16:26 +00:00
|
|
|
export raft_api
|
2023-08-22 01:04:47 +00:00
|
|
|
|
2023-09-23 01:26:45 +00:00
|
|
|
proc RaftTimerCreateCustomImpl*(timerInterval: int, timerCallback: RaftTimerCallback): Future[void] {.async.} =
|
2023-09-07 02:41:05 +00:00
|
|
|
var f = sleepAsync(milliseconds(timerInterval))
|
2023-09-06 16:18:02 +00:00
|
|
|
await f
|
2023-09-22 01:34:44 +00:00
|
|
|
if f.finished and not f.cancelled:
|
2023-09-06 16:18:02 +00:00
|
|
|
timerCallback()
|