Bug 1: The flushScheduled flag could become stuck true if scheduleFlush()
failed or was interrupted, preventing future timer-based flushes for
low-volume threads. Fix: always clear flushScheduled after any drain, and
reset the flag on schedule failure via catchCause.
Bug 2: A single transient I/O error permanently added a thread segment to
failedSegments, silencing all future logging for that thread. Fix: start
each drain with a fresh failedSegments set so transient errors don't block
subsequent flush attempts.