Skip to content

Commit

Permalink
Don't run flush_source if scheduler is not started.
Browse files Browse the repository at this point in the history
  • Loading branch information
toots committed Nov 11, 2024
1 parent 3a2dbb4 commit fb28dac
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/core/builtins/builtins_source.ml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ let flush_source ~log ~name ~ratio ~timeout ~sleep_latency s =
let _ =
new Output.dummy
~clock ~infallible:false
~on_start:(fun () -> ())
~on_start:(fun () -> started := true)
~on_stop:(fun () -> stopped := true)
~register_telnet:false ~autostart:true (Lang.source s)
in
Expand All @@ -195,7 +195,6 @@ let flush_source ~log ~name ~ratio ~timeout ~sleep_latency s =
in
(try
while (not (Atomic.get should_stop)) && not !stopped do
if not !started then started := s#is_ready;
if (not !started) && Time.(timeout_time |<=| start_time) then (
log#important "Timeout while waiting for the source to start!";
stopped := true)
Expand All @@ -213,6 +212,11 @@ let flush_source ~log ~name ~ratio ~timeout ~sleep_latency s =
processing_time effective_ratio;
Clock.stop clock

let flush_source ~log ~name ~ratio ~timeout ~sleep_latency s =
if Tutils.running () then
flush_source ~log ~name ~ratio ~timeout ~sleep_latency s
else log#important "Cannot run %s: scheduler not started!" name

let _ =
let log = Log.make ["source"; "dump"] in
let kind = Lang.univ_t () in
Expand Down

0 comments on commit fb28dac

Please sign in to comment.