diff options
| author | hitsedesen <[email protected]> | 2024-11-12 11:22:35 +0300 |
|---|---|---|
| committer | hitsedesen <[email protected]> | 2024-11-12 11:34:54 +0300 |
| commit | a382b5a084ab43b219041ee759e3a3d523205320 (patch) | |
| tree | dce6675c7c404dfdfee0de1f50718b8a2088c62d | |
| parent | 85af4d13061cfebb81674f0280d5f7835c0b08b4 (diff) | |
YT: Post-commit fixes for throttling time
commit_hash:e23a92102b67714ab31f781cca1068fb9983357a
| -rw-r--r-- | yt/yt/core/rpc/service.h | 3 | ||||
| -rw-r--r-- | yt/yt/core/rpc/service_detail.cpp | 8 |
2 files changed, 6 insertions, 5 deletions
diff --git a/yt/yt/core/rpc/service.h b/yt/yt/core/rpc/service.h index 3eb6d06a70c..def1b8dbf02 100644 --- a/yt/yt/core/rpc/service.h +++ b/yt/yt/core/rpc/service.h @@ -82,7 +82,8 @@ struct IServiceContext //! Returns time between request execution start and the moment of reply or cancellation (if it already happened). virtual std::optional<TDuration> GetExecutionDuration() const = 0; - //! Substract given throttle duration time from request execution time. + //! This duration will be subtracted from the request execution time. + //! Can be called multiple times; these durations are added up. virtual void RecordThrottling(TDuration throttleDuration) = 0; //! Returns trace context associated with request. diff --git a/yt/yt/core/rpc/service_detail.cpp b/yt/yt/core/rpc/service_detail.cpp index b51529f85df..d6c062b9c9e 100644 --- a/yt/yt/core/rpc/service_detail.cpp +++ b/yt/yt/core/rpc/service_detail.cpp @@ -635,7 +635,7 @@ public: void RecordThrottling(TDuration throttleDuration) override { - ThrottlingTime_ = ThrottlingTime_ ? *ThrottlingTime_ + throttleDuration : throttleDuration; + ThrottlingTime_ = ThrottlingTime_ + throttleDuration; if (ExecutionTime_) { *ExecutionTime_ -= throttleDuration; } @@ -765,7 +765,7 @@ private: std::optional<TInstant> RunInstant_; std::optional<TInstant> ReplyInstant_; std::optional<TInstant> CancelInstant_; - std::optional<TDuration> ThrottlingTime_; + TDuration ThrottlingTime_; std::optional<TDuration> ExecutionTime_; std::optional<TDuration> TotalTime_; @@ -1055,8 +1055,8 @@ private: ReplyInstant_ = NProfiling::GetInstant(); ExecutionTime_ = RunInstant_ ? *ReplyInstant_ - *RunInstant_ : TDuration(); - if (RunInstant_ && ThrottlingTime_) { - *ExecutionTime_ -= *ThrottlingTime_; + if (RunInstant_) { + *ExecutionTime_ -= ThrottlingTime_; } TotalTime_ = *ReplyInstant_ - ArriveInstant_; |
