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 sleep_s = float sleep_ms /. 1000. in
let tick_loop () =
try
while not @@ Atomic.get stop do
Thread.delay sleep_s;
B.tick ()
done
with B_queue.Closed -> ()
in
start_bg_thread tick_loop