def METHOD_NAME(self):
    calls = Queue()
    class QueuePublisher(Publisher):
        def publish(self, _events: List[Event]):
            calls.put(_events)
    buffer = PublisherBuffer(QueuePublisher(), flush_size=2, flush_interval=1000)
    t = threading.Thread(target=buffer.run)
    t.start()
    try:
        e1 = new_event()
        e2 = new_event()
        e3 = new_event()
        buffer.handle(e1)
        buffer.handle(e2)
        c1 = calls.get(timeout=2)
        assert len(c1) == 2
        buffer.handle(e3)  # should flush after close despite flush_size = 2
    finally:
        buffer.close()
    c2 = calls.get(timeout=2)
    assert len(c2) == 1
    assert c1[0] == e1
    assert c1[1] == e2
    assert c2[0] == e3
    t.join(10)