maxQueueSize property
The most entries the queue accepts before it starts refusing them.
Counts what has been accepted and not yet finished: the entries waiting
in the queue plus the batch being handled right now. At the limit it is
the incoming entry that is refused — it goes to onDropped and never
enters the queue. Everything already accepted is still delivered, so
flush and close promise exactly what they promised before, and a
batch handed back through the retry buffer is never cut: it was
accepted long ago.
The default is 100 000 entries. At a thousand logs a second that is a hundred seconds of a sink that is not draining — an outage rather than a burst — and around 20 MB held, at two hundred bytes a log.
The queue drains only when the event loop turns, so a synchronous loop
that publishes more than this without awaiting anything loses the rest
however healthy the sink is — nothing has had a chance to run it yet.
That loop, not the outage, is what the default is sized against: this
package's own benchmark publishes 20 000 logs in exactly such a burst,
and the bound carries all of it. A batch job that writes millions of
lines without awaiting still needs a bound of its own, or null.
null gives the bound up on purpose: the queue then grows until the
process runs out of memory. That is the right trade only when the input
is bounded elsewhere and losing a log is worse than dying.
Implementation
final int? maxQueueSize;