Skip to content

Commit 3cf7222

Browse files
committed
Fix put deadlines
1 parent 1b7f2bc commit 3cf7222

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

ydb/core/blobstorage/dsproxy/dsproxy_put.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class TBlobStorageGroupPutRequest : public TBlobStorageGroupRequestActor {
4242
TErasureSplitContext ErasureSplitContext = TErasureSplitContext::Init(MaxBytesToSplitAtOnce);
4343
TBatchedVec<TStackVec<TRope, TypicalPartsInBlob>> PartSets;
4444

45-
std::set<TInstant> PutDeadlines;
45+
std::set<TMonotonic> PutDeadlines;
4646
TStackVec<ui64, TypicalDisksInGroup> WaitingVDiskResponseCount;
4747
ui64 WaitingVDiskCount = 0;
4848

@@ -796,15 +796,17 @@ class TBlobStorageGroupPutRequest : public TBlobStorageGroupRequestActor {
796796
<< " State# " << PutImpl.DumpFullState());
797797
}
798798

799-
void ScheduleWakeup() {
800-
TInstant deadline = TActivationContext::Now() + TDuration::MilliSeconds(DsPutWakeupMs);
801-
802-
auto it = PutDeadlines.begin();
803-
if (it != PutDeadlines.end() && *it <= deadline) {
804-
deadline = *it;
805-
PutDeadlines.erase(it);
799+
void ScheduleWakeups() {
800+
TMonotonic now = TActivationContext::Monotonic();
801+
while (!PutDeadlines.empty()) {
802+
TMonotonic deadline = *PutDeadlines.begin();
803+
PutDeadlines.erase(PutDeadlines.begin());
804+
if (deadline > now) {
805+
Schedule(deadline, new TKikimrEvents::TEvWakeup);
806+
return;
807+
}
806808
}
807-
Schedule(deadline, new TKikimrEvents::TEvWakeup);
809+
Schedule(TDuration::MilliSeconds(DsPutWakeupMs), new TKikimrEvents::TEvWakeup);
808810
}
809811

810812
STATEFN(StateWait) {

0 commit comments

Comments
 (0)