diff options
| author | danilalexeev <[email protected]> | 2024-07-09 13:39:43 +0300 |
|---|---|---|
| committer | danilalexeev <[email protected]> | 2024-07-09 14:04:00 +0300 |
| commit | a9a44ec0ddef6f9e9cc0d4acf26b8e52bd2358ab (patch) | |
| tree | 7c8608eb86ea296994155fc6c50852d91ed30356 | |
| parent | 2bd5c6081b9738dd32827b1701d2ccf827c147f0 (diff) | |
YT-22200: Move IInvoker to TFutureTimeoutOptions for TFuture::WithDeadline
772b8c0488741c8c4021bf1dd1d455fe3a6f106f
| -rw-r--r-- | yt/yt/core/actions/future-inl.h | 20 | ||||
| -rw-r--r-- | yt/yt/core/actions/future.h | 14 |
2 files changed, 14 insertions, 20 deletions
diff --git a/yt/yt/core/actions/future-inl.h b/yt/yt/core/actions/future-inl.h index 2a2133225c9..6ed80a44586 100644 --- a/yt/yt/core/actions/future-inl.h +++ b/yt/yt/core/actions/future-inl.h @@ -862,8 +862,7 @@ template <class T, class D> TFuture<T> ApplyTimeoutHelper( TFutureBase<T> this_, D timeoutOrDeadline, - TFutureTimeoutOptions options, - IInvokerPtr invoker) + TFutureTimeoutOptions options) { auto promise = NewPromise<T>(); @@ -888,7 +887,7 @@ TFuture<T> ApplyTimeoutHelper( cancelable.Cancel(error); }), timeoutOrDeadline, - std::move(invoker)); + options.Invoker); this_.Subscribe(BIND_NO_PROPAGATE([=] (const NYT::TErrorOr<T>& value) { NConcurrency::TDelayedExecutor::Cancel(cookie); @@ -1133,8 +1132,7 @@ TFuture<T> TFutureBase<T>::ToImmediatelyCancelable() const template <class T> TFuture<T> TFutureBase<T>::WithDeadline( TInstant deadline, - TFutureTimeoutOptions options, - IInvokerPtr invoker) const + TFutureTimeoutOptions options) const { YT_ASSERT(Impl_); @@ -1142,14 +1140,13 @@ TFuture<T> TFutureBase<T>::WithDeadline( return TFuture<T>(Impl_); } - return NYT::NDetail::ApplyTimeoutHelper(*this, deadline, std::move(options), std::move(invoker)); + return NYT::NDetail::ApplyTimeoutHelper(*this, deadline, std::move(options)); } template <class T> TFuture<T> TFutureBase<T>::WithTimeout( TDuration timeout, - TFutureTimeoutOptions options, - IInvokerPtr invoker) const + TFutureTimeoutOptions options) const { YT_ASSERT(Impl_); @@ -1157,16 +1154,15 @@ TFuture<T> TFutureBase<T>::WithTimeout( return TFuture<T>(Impl_); } - return NYT::NDetail::ApplyTimeoutHelper(*this, timeout, std::move(options), std::move(invoker)); + return NYT::NDetail::ApplyTimeoutHelper(*this, timeout, std::move(options)); } template <class T> TFuture<T> TFutureBase<T>::WithTimeout( std::optional<TDuration> timeout, - TFutureTimeoutOptions options, - IInvokerPtr invoker) const + TFutureTimeoutOptions options) const { - return timeout ? WithTimeout(*timeout, std::move(options), std::move(invoker)) : TFuture<T>(Impl_); + return timeout ? WithTimeout(*timeout, std::move(options)) : TFuture<T>(Impl_); } template <class T> diff --git a/yt/yt/core/actions/future.h b/yt/yt/core/actions/future.h index 5d624050e65..a90ae22b4f5 100644 --- a/yt/yt/core/actions/future.h +++ b/yt/yt/core/actions/future.h @@ -169,6 +169,9 @@ struct TFutureTimeoutOptions //! If set to a non-trivial error, timeout or cancelation errors //! are enveloped into this error. TError Error; + + //! An invoker the timeout event is handled in (DelayedExecutor is null). + IInvokerPtr Invoker; }; //////////////////////////////////////////////////////////////////////////////// @@ -283,23 +286,18 @@ public: //! Returns a future that is either set to an actual value (if the original one is set in timely manner) //! or to |EErrorCode::Timeout| (in case the deadline is reached). - //! The timeout event is handled in #invoker (DelayedExecutor is null). TFuture<T> WithDeadline( TInstant deadline, - TFutureTimeoutOptions options = {}, - IInvokerPtr invoker = nullptr) const; + TFutureTimeoutOptions options = {}) const; //! Returns a future that is either set to an actual value (if the original one is set in timely manner) //! or to |EErrorCode::Timeout| (in case of timeout). - //! The timeout event is handled in #invoker (DelayedExecutor is null). TFuture<T> WithTimeout( TDuration timeout, - TFutureTimeoutOptions options = {}, - IInvokerPtr invoker = nullptr) const; + TFutureTimeoutOptions options = {}) const; TFuture<T> WithTimeout( std::optional<TDuration> timeout, - TFutureTimeoutOptions options = {}, - IInvokerPtr invoker = nullptr) const; + TFutureTimeoutOptions options = {}) const; //! Chains the asynchronous computation with another one. template <class R> |
