mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-11 21:18:33 -04:00
fix: do not emit empty batches
This commit is contained in:
parent
16667a3fcf
commit
41e9962c08
1 changed files with 2 additions and 3 deletions
|
|
@ -240,13 +240,12 @@ end = struct
|
||||||
|
|
||||||
let pop_if_ready ?(force = false) ~now (self : _ t) : _ list option =
|
let pop_if_ready ?(force = false) ~now (self : _ t) : _ list option =
|
||||||
let@ () = with_mutex_ self.lock in
|
let@ () = with_mutex_ self.lock in
|
||||||
if
|
if self.size > 0 && (force || is_full_ self || timeout_expired_ ~now self)
|
||||||
(force && not (is_empty_ self))
|
|
||||||
|| is_full_ self || timeout_expired_ ~now self
|
|
||||||
then (
|
then (
|
||||||
let l = self.q in
|
let l = self.q in
|
||||||
self.q <- [];
|
self.q <- [];
|
||||||
self.size <- 0;
|
self.size <- 0;
|
||||||
|
assert (l <> []);
|
||||||
Some l
|
Some l
|
||||||
) else
|
) else
|
||||||
None
|
None
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue