public boolean shouldFlush(Duration flushInterval) {
        final long lastFlush = lastFlushTime.get();
        // If we don't know the last flush time, we want to flush. Happens with a new buffer instance.
        return lastFlush == 0 || (System.nanoTime() - lastFlush) > flushInterval.toNanos();
    }
@Test
    void shouldFlush() {
        // No interactions yet, we want to flush because we don't know the last execution time.
        assertThat(buffer.shouldFlush(Duration.ofSeconds(1))).isTrue();

        // Trigger a flush
        buffer.flush(flusher);

        // The last flush just happened, flush interval not reached.
        assertThat(buffer.shouldFlush(Duration.ofDays(1))).isFalse();

        // The last flush was more than 1 ns ago, flush.
        assertThat(buffer.shouldFlush(Duration.ofNanos(1))).isTrue();
    }