Skip to content

Commit b9f90f9

Browse files
committed
revert: Eio.Time to Unix.sleepf
1 parent e20946a commit b9f90f9

File tree

5 files changed

+5
-25
lines changed

5 files changed

+5
-25
lines changed

deku-p/src/core/bin/node/deku_node.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ let main params style_renderer log_level =
9393
Eio_main.run @@ fun env ->
9494
Eio.Switch.run @@ fun sw ->
9595
Parallel.Pool.run ~env ~domains @@ fun () ->
96-
Clock.init (Eio.Stdenv.clock env);
9796
Logs.info (fun m -> m "Using %d domains" domains);
9897
Logs.info (fun m -> m "Default block size: %d" default_block_size);
9998
let indexer =

deku-p/src/core/chain/chain.ml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ let minimum_block_latency =
117117
| Some x -> Option.value ~default:0.0 (Float.of_string_opt x)
118118
| None -> 0.0
119119

120-
let next_sleep_until = ref 0.0
120+
let last_sleep : float ref = ref @@ Unix.gettimeofday ()
121121

122122
(* after gossip *)
123123
let apply_consensus_action chain consensus_action =
@@ -139,9 +139,10 @@ let apply_consensus_action chain consensus_action =
139139
(match minimum_block_latency with
140140
| 0. -> ()
141141
| minimum_block_latency ->
142-
let () = Clock.sleep_until !next_sleep_until in
143-
let now = Clock.now () in
144-
next_sleep_until := now +. minimum_block_latency);
142+
let now = Unix.gettimeofday () in
143+
let sleep = minimum_block_latency -. (now -. !last_sleep) in
144+
if sleep > 0.0 then Unix.sleepf sleep;
145+
last_sleep := Unix.gettimeofday ());
145146
(chain, [ Chain_fragment { fragment } ])
146147
| Consensus_vote { level; vote } ->
147148
let content = Message.Content.vote ~level ~vote in

deku-p/src/core/stdlib/clock.ml

Lines changed: 0 additions & 18 deletions
This file was deleted.

deku-p/src/core/stdlib/deku_stdlib.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ module IO = Io
66
include Let_syntax
77
module Parallel = Parallel
88
module List = List_ext
9-
module Clock = Clock

deku-p/src/core/stdlib/deku_stdlib.mli

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ module IO = Io
1111

1212
module Parallel = Parallel
1313
module List = List_ext
14-
module Clock = Clock

0 commit comments

Comments
 (0)