aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralexvru <alexvru@ydb.tech>2023-04-07 10:54:21 +0300
committeralexvru <alexvru@ydb.tech>2023-04-07 10:54:21 +0300
commit4ca1746fe0f9526f3baf2d6bc56442b106de3f45 (patch)
tree2d9316532f6d82447c888fa706fd4260826b4c22
parentb3c11e8eea7183b6bca2907a30e6de04c1c5938e (diff)
downloadydb-4ca1746fe0f9526f3baf2d6bc56442b106de3f45.tar.gz
Fix channel scheduler
-rw-r--r--library/cpp/actors/interconnect/channel_scheduler.h16
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 551a4cb61a..1528810d0d 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;
}