 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hedged ¶
type Hedged[T any] struct { // The function must be thread-safe because multiple instances may be running // concurrently. The function must return as soon as possible after context // cancellation, otherwise the speculation makes no sense. // // The function argument indicates whether this is a speculative retry attempt. Call Call[T] Trigger <-chan time.Time // FailFast specifies how a failure is handled. If it is set to true: // - the result received first is returned, regardless of anything. // - if Call fails before the trigger fires, it won't be retried. FailFast bool }
Hedged executes Call with a speculative retry after trigger fires if it has not returned earlier.
By default, if one of the attempts fails, another one is not canceled. In this case the speculative attempt will not start until the trigger fires. For more granular control, use FailFast.
 Click to show internal directories. 
   Click to hide internal directories.