Skip to content

Commit

Permalink
fix: do not emit empty batches
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Jul 6, 2022
1 parent 16667a3 commit 41e9962
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/client/opentelemetry_client_ocurl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,12 @@ end = struct

let pop_if_ready ?(force = false) ~now (self : _ t) : _ list option =
let@ () = with_mutex_ self.lock in
if
(force && not (is_empty_ self))
|| is_full_ self || timeout_expired_ ~now self
if self.size > 0 && (force || is_full_ self || timeout_expired_ ~now self)
then (
let l = self.q in
self.q <- [];
self.size <- 0;
assert (l <> []);
Some l
) else
None
Expand Down

0 comments on commit 41e9962

Please sign in to comment.