in remove_backend, call tick() then cleanup() on it

This commit is contained in:
Simon Cruanes 2024-10-16 13:28:47 -04:00
parent 97030757c1
commit a44c5dc33a

View file

@ -175,7 +175,12 @@ module Collector = struct
(** Remove current backend, if any.
@since NEXT_RELEASE *)
let remove_backend () : unit = Atomic.set backend None
let remove_backend () : unit =
match Atomic.exchange backend None with
| None -> ()
| Some (module B) ->
B.tick ();
B.cleanup ()
(** Is there a configured backend? *)
let[@inline] has_backend () : bool = Atomic.get backend != None