Skip to content

Commit

Permalink
Merge 62a5034 into b69d555
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanmorozov333 authored Sep 23, 2024
2 parents b69d555 + 62a5034 commit b1cf99c
Showing 1 changed file with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -939,13 +939,14 @@ class TPortionsBucket: public TMoveOnly {
dest.MoveNextBorderTo(*this);
}

void Actualize(const TInstant currentInstant) {
[[nodiscard]] bool Actualize(const TInstant currentInstant) {
if (currentInstant < NextActualizeInstant) {
return;
return false;
}
auto gChartsThis = StartModificationGuard();
NextActualizeInstant = Others.Actualize(currentInstant);
RebuildOptimizedFeature(currentInstant);
return true;
}

void SplitOthersWith(TPortionsBucket& dest) {
Expand Down Expand Up @@ -984,7 +985,11 @@ class TPortionBuckets {
}

void RemoveBucketFromRating(const std::shared_ptr<TPortionsBucket>& bucket) {
auto it = BucketsByWeight.find(bucket->GetLastWeight());
return RemoveBucketFromRating(bucket, bucket->GetLastWeight());
}

void RemoveBucketFromRating(const std::shared_ptr<TPortionsBucket>& bucket, const i64 rating) {
auto it = BucketsByWeight.find(rating);
AFL_VERIFY(it != BucketsByWeight.end());
AFL_VERIFY(it->second.erase(bucket.get()));
if (it->second.empty()) {
Expand Down Expand Up @@ -1068,9 +1073,7 @@ class TPortionBuckets {
if (BucketsByWeight.empty()) {
return false;
}
if (BucketsByWeight.rbegin()->second.empty()) {
return false;
}
AFL_VERIFY(BucketsByWeight.rbegin()->second.size());
const TPortionsBucket* bucketForOptimization = *BucketsByWeight.rbegin()->second.begin();
return bucketForOptimization->IsLocked(dataLocksManager);
}
Expand All @@ -1090,9 +1093,11 @@ class TPortionBuckets {
LeftBucket->Actualize(currentInstant);
AddBucketToRating(LeftBucket);
for (auto&& i : Buckets) {
RemoveBucketFromRating(i.second);
i.second->Actualize(currentInstant);
AddBucketToRating(i.second);
const i64 rating = i.second->GetWeight();
if (i.second->Actualize(currentInstant)) {
RemoveBucketFromRating(i.second, rating);
AddBucketToRating(i.second);
}
}
}

Expand Down

0 comments on commit b1cf99c

Please sign in to comment.