Queue operations for telemetry events.
Manages enqueueing, dequeueing, and size tracking of telemetry events with overflow protection.
Summary
Functions
Drain the queue and return all events as a list.
Enqueue an event to the queue.
Check if flush should be requested based on queue size vs threshold.
Schedule the next flush timer.
Wait until push_counter == flush_counter or timeout.
Functions
Drain the queue and return all events as a list.
Returns {events, updated_state} where the queue is now empty
and flush_counter is incremented by the number of events.
Enqueue an event to the queue.
Returns {state, true} if accepted, {state, false} if queue is full.
Increments the push_counter when an event is enqueued.
Check if flush should be requested based on queue size vs threshold.
Schedule the next flush timer.
Wait until push_counter == flush_counter or timeout.
Returns true if drained within timeout, false otherwise.