I want to cache the events in bulk_message if its size is less than flush_size (line 62-64), and send them out when they reach the flush_size (line 65-67). And in the end send out the left entries in bulk_message (line 70,71). Is there any logic error?