mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-07 18:37:56 -05:00
fix ocurl: have ticker thread stop when work queue is closed
This commit is contained in:
parent
a62f1d891a
commit
d1c59a59bc
1 changed files with 6 additions and 4 deletions
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue