Class Retrier

Inheritance Relationships

Derived Type

Class Documentation

class Microsoft::XboxStudios::Heimdall::Retrier

Subclassed by HeimdallRetrier

Public Functions

inline Retrier(tl::optional<unsigned int> maxRetryCount = tl::none<unsigned int>(), double retryDelayMs = 10000)

Constructs a Retrier object.

Parameters
  • maxRetryCount – The maximum amount of time to retry a method. Infinite if none is passed.

  • retryDelayMs – The amount of time to wait between retries in milliseconds. 10000 is the default value.

template<typename TResult, typename TState>
inline TResult Run(std::function<TResult(TState&)> func, std::weak_ptr<TState> state, std::function<bool(TResult&)> isFatalError, TResult operationCanceledResult)

Keeps executing a method until one of the following conditions are met:

  • The method returned a success.

  • The method returned a fatal error.

  • The maxRetryCount has been met.

Template Parameters
  • TResult – An instance of tl::expected<T, E>

  • TState – The state type used to pass to the func.

Parameters
  • func – The method to execute.

  • state – The state to pass to the method. If state was destroyed at start, this method automatically exits.

  • operationCanceledResult – The result to return when method exits because state was destroyed.