- if int64(arvlog.bufToFlush.Len()) > crunchLogBytesPerEvent ||
- (now.Sub(arvlog.bufFlushedAt) >= crunchLogSecondsBetweenEvents) {
+ if (int64(arvlog.bufToFlush.Len()) >= crunchLogBytesPerEvent ||
+ (now.Sub(arvlog.bufFlushedAt) >= crunchLogSecondsBetweenEvents) ||
+ arvlog.closing) && (arvlog.bufToFlush.Len() > 0) {