mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-08 03:47:59 -04:00
refactor, remove debug print
This commit is contained in:
parent
374a67c97a
commit
631f7cd01a
1 changed files with 7 additions and 9 deletions
|
|
@ -61,18 +61,19 @@ end = struct
|
|||
if self.closed then
|
||||
Closed
|
||||
else (
|
||||
let xs = ref xs in
|
||||
let to_push = ref xs in
|
||||
|
||||
let continue = ref true in
|
||||
while !continue && Queue.length self.q < high_watermark do
|
||||
match !xs with
|
||||
match !to_push with
|
||||
| [] -> continue := false
|
||||
| x :: tl_xs ->
|
||||
xs := tl_xs;
|
||||
to_push := tl_xs;
|
||||
Queue.push x self.q
|
||||
done;
|
||||
|
||||
let num_discarded = List.length !xs in
|
||||
let num_discarded = List.length !to_push in
|
||||
(* Printf.eprintf "bq: pushed %d items\n%!" (List.length xs - num_discarded); *)
|
||||
Pushed { num_discarded }
|
||||
)
|
||||
end
|
||||
|
|
@ -90,13 +91,10 @@ let push (self : _ state) x =
|
|||
Q.push_while_not_full self.q ~high_watermark:self.high_watermark x
|
||||
with
|
||||
| Closed ->
|
||||
Printf.eprintf "bounded queue: warning: queue is closed\n%!";
|
||||
ignore (Atomic.fetch_and_add self.n_discarded (List.length x) : int)
|
||||
| Pushed { num_discarded } ->
|
||||
if num_discarded > 0 then (
|
||||
Printf.eprintf "DISCARD %d items\n%!" num_discarded;
|
||||
ignore (Atomic.fetch_and_add self.n_discarded num_discarded : int)
|
||||
);
|
||||
if num_discarded > 0 then
|
||||
ignore (Atomic.fetch_and_add self.n_discarded num_discarded : int);
|
||||
|
||||
(* wake up potentially asleep consumers *)
|
||||
Cb_set.trigger self.on_non_empty
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue