File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,8 @@ struct IServiceContext
82
82
// ! Returns time between request execution start and the moment of reply or cancellation (if it already happened).
83
83
virtual std::optional<TDuration> GetExecutionDuration () const = 0;
84
84
85
- // ! Substract given throttle duration time from request execution time.
85
+ // ! This duration will be subtracted from the request execution time.
86
+ // ! Can be called multiple times; these durations are added up.
86
87
virtual void RecordThrottling (TDuration throttleDuration) = 0;
87
88
88
89
// ! Returns trace context associated with request.
Original file line number Diff line number Diff line change @@ -635,7 +635,7 @@ class TServiceBase::TServiceContext
635
635
636
636
void RecordThrottling (TDuration throttleDuration) override
637
637
{
638
- ThrottlingTime_ = ThrottlingTime_ ? *ThrottlingTime_ + throttleDuration : throttleDuration;
638
+ ThrottlingTime_ = ThrottlingTime_ + throttleDuration;
639
639
if (ExecutionTime_) {
640
640
*ExecutionTime_ -= throttleDuration;
641
641
}
@@ -765,7 +765,7 @@ class TServiceBase::TServiceContext
765
765
std::optional<TInstant> RunInstant_;
766
766
std::optional<TInstant> ReplyInstant_;
767
767
std::optional<TInstant> CancelInstant_;
768
- std::optional< TDuration> ThrottlingTime_;
768
+ TDuration ThrottlingTime_;
769
769
770
770
std::optional<TDuration> ExecutionTime_;
771
771
std::optional<TDuration> TotalTime_;
@@ -1055,8 +1055,8 @@ class TServiceBase::TServiceContext
1055
1055
1056
1056
ReplyInstant_ = NProfiling::GetInstant ();
1057
1057
ExecutionTime_ = RunInstant_ ? *ReplyInstant_ - *RunInstant_ : TDuration ();
1058
- if (RunInstant_ && ThrottlingTime_ ) {
1059
- *ExecutionTime_ -= * ThrottlingTime_;
1058
+ if (RunInstant_) {
1059
+ *ExecutionTime_ -= ThrottlingTime_;
1060
1060
}
1061
1061
TotalTime_ = *ReplyInstant_ - ArriveInstant_;
1062
1062
You can’t perform that action at this time.
0 commit comments