Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Test.Sandwich.Waits
Contents
Description
This module contains helper functions for waiting.
It can be very useful in tests to retry something, with a reasonable backoff policy to prevent the test from consuming lots of CPU while waiting.
Synopsis
- waitUntil :: forall m a. (HasCallStack, MonadUnliftIO m) => Double -> m a -> m a
- waitUntil' :: forall m a. (HasCallStack, MonadUnliftIO m) => RetryPolicy -> Double -> m a -> m a
- defaultRetryPolicy :: RetryPolicy
General waits
waitUntil :: forall m a. (HasCallStack, MonadUnliftIO m) => Double -> m a -> m a Source #
Keep trying an action up to a timeout while it fails with a FailureReason
.
Use exponential backoff, with delays capped at 1 second.
waitUntil' :: forall m a. (HasCallStack, MonadUnliftIO m) => RetryPolicy -> Double -> m a -> m a Source #
Same as waitUntil
, but with a configurable retry policy.
defaultRetryPolicy :: RetryPolicy Source #
The default retry policy.