From b3efac560d35dc2ec4fdb1b2cc1172db2c93765e Mon Sep 17 00:00:00 2001 From: dimagolomozy Date: Wed, 4 Sep 2024 01:11:20 +0300 Subject: [PATCH] sync time if buf not empty --- manager.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manager.go b/manager.go index 256b064..c915ab6 100644 --- a/manager.go +++ b/manager.go @@ -98,16 +98,16 @@ func (manager *LoggerManager) AddLogLine(Severity uint, Text interface{}, Catego // SendBulk send logs bulk to Coralogix func (manager *LoggerManager) SendBulk(SyncTime bool) bool { - if SyncTime { - manager.UpdateTimeDeltaInterval() - } - BufferLenToSend := manager.LogsBuffer.Len() if BufferLenToSend < 1 { DebugLogger.Println("buffer is empty, there is nothing to send!") return false } + if SyncTime { + manager.UpdateTimeDeltaInterval() + } + for manager.LogsBuffer.Size() > MaxLogChunkSize && BufferLenToSend > 1 { BufferLenToSend = BufferLenToSend / 2 }