fix ocurl: have ticker thread stop when work queue is closed

This commit is contained in:
Simon Cruanes 2023-09-19 10:13:36 -04:00
parent a62f1d891a
commit d1c59a59bc
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -435,10 +435,12 @@ let mk_backend ~stop ~config () : (module Collector.BACKEND) =
let setup_ticker_thread ~stop ~sleep_ms (module B : Collector.BACKEND) () = let setup_ticker_thread ~stop ~sleep_ms (module B : Collector.BACKEND) () =
let sleep_s = float sleep_ms /. 1000. in let sleep_s = float sleep_ms /. 1000. in
let tick_loop () = let tick_loop () =
while not @@ Atomic.get stop do try
Thread.delay sleep_s; while not @@ Atomic.get stop do
B.tick () Thread.delay sleep_s;
done B.tick ()
done
with B_queue.Closed -> ()
in in
start_bg_thread tick_loop start_bg_thread tick_loop