File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
include/cpp-statsd-client Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -246,8 +246,8 @@ inline void UDPSender::queueMessage(const std::string& message) noexcept {
246246 // We aquire a lock but only if we actually need to (i.e. there is a thread also accessing the queue)
247247 auto batchingLock =
248248 m_batchingThread.joinable () ? std::unique_lock<std::mutex>(m_batchingMutex) : std::unique_lock<std::mutex>();
249- // Either we don't have a place to batch our message or we exceeded the batch size, so make a new batch
250- if (m_batchingMessageQueue.empty () || m_batchingMessageQueue.back ().length () > m_batchsize) {
249+ // Either we don't have a place to batch our message or we are about to exceed the batch size, so make a new batch
250+ if (m_batchingMessageQueue.empty () || m_batchingMessageQueue.back ().size () + message. size () > m_batchsize) {
251251 m_batchingMessageQueue.emplace_back ();
252252 m_batchingMessageQueue.back ().reserve (m_batchsize + 256 );
253253 } // When there is already a batch open we need a separator when its not empty
You can’t perform that action at this time.
0 commit comments