diff options
author | alexvru <alexvru@ydb.tech> | 2023-04-07 10:54:21 +0300 |
---|---|---|
committer | alexvru <alexvru@ydb.tech> | 2023-04-07 10:54:21 +0300 |
commit | 4ca1746fe0f9526f3baf2d6bc56442b106de3f45 (patch) | |
tree | 2d9316532f6d82447c888fa706fd4260826b4c22 /library/cpp | |
parent | b3c11e8eea7183b6bca2907a30e6de04c1c5938e (diff) | |
download | ydb-4ca1746fe0f9526f3baf2d6bc56442b106de3f45.tar.gz |
Fix channel scheduler
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/actors/interconnect/channel_scheduler.h | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/library/cpp/actors/interconnect/channel_scheduler.h b/library/cpp/actors/interconnect/channel_scheduler.h index 551a4cb61a1..1528810d0d8 100644 --- a/library/cpp/actors/interconnect/channel_scheduler.h +++ b/library/cpp/actors/interconnect/channel_scheduler.h @@ -48,12 +48,11 @@ namespace NActors { } void AddToHeap(TEventOutputChannel& channel, ui64 counter) { - if (channel.IsWorking()) { - ui64 weight = channel.WeightConsumedOnPause; - weight -= Min(weight, counter - channel.EqualizeCounterOnPause); - Heap.push_back(THeapItem{&channel, weight}); - std::push_heap(Heap.begin(), Heap.end()); - } + Y_VERIFY_DEBUG(channel.IsWorking()); + ui64 weight = channel.WeightConsumedOnPause; + weight -= Min(weight, counter - channel.EqualizeCounterOnPause); + Heap.push_back(THeapItem{&channel, weight}); + std::push_heap(Heap.begin(), Heap.end()); } void FinishPick(ui64 weightConsumed, ui64 counter) { @@ -94,10 +93,7 @@ namespace NActors { } // find the minimum consumed weight among working channels and then adjust weights - ui64 min = Max<ui64>(); - for (THeapItem& item : Heap) { - min = Min(min, item.WeightConsumed); - } + const ui64 min = Heap.front().WeightConsumed; for (THeapItem& item : Heap) { item.WeightConsumed -= min; } |