From 3e306dfc87eef33670765d97b72a833628e04cba Mon Sep 17 00:00:00 2001 From: kulikov Date: Mon, 23 Mar 2026 17:14:35 +0300 Subject: Allow to change (reduce) max queue size for common elastic queue Add same method as in TFastElasticQueue, and test. commit_hash:0a2b618325e57c32fd269254a7dbe912849c3f10 --- library/cpp/threading/equeue/equeue.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'library/cpp/threading/equeue/equeue.cpp') diff --git a/library/cpp/threading/equeue/equeue.cpp b/library/cpp/threading/equeue/equeue.cpp index 54b088635d5..bc0b6fc8144 100644 --- a/library/cpp/threading/equeue/equeue.cpp +++ b/library/cpp/threading/equeue/equeue.cpp @@ -10,7 +10,7 @@ size_t TElasticQueue::ObjectCount() const { } bool TElasticQueue::TryIncCounter() { - if (++GuardCount_ > MaxQueueSize_) { + if (++GuardCount_ > CurrentMaxQueueSize_) { --GuardCount_; return false; } @@ -68,6 +68,7 @@ bool TElasticQueue::Add(IObjectInQueue* obj) { void TElasticQueue::Start(size_t threadCount, size_t maxQueueSize) { MaxQueueSize_ = maxQueueSize; + CurrentMaxQueueSize_ = maxQueueSize; SlaveQueue_->Start(threadCount, maxQueueSize); } -- cgit v1.3