network-wait-0.2.0.0: Lightweight library for waiting on networked services to become available.
Safe HaskellNone
LanguageHaskell2010

Network.Wait.Redis

Description

This module exports variants of the functions from Network.Wait specialised for Redis servers. In addition to checking whether a connection can be established, the functions in this module also check whether the Redis server is ready to accept commands using checkedConnect. Unlike checkedConnect, we don't give up if the connection fails, but instead use the specified retry policy to try again. All functions in this module return the established connection if successful.

Synopsis

Documentation

waitRedis :: (MonadIO m, MonadMask m) => RetryPolicyM m -> ConnectInfo -> m Connection Source #

waitRedis retryPolicy connectInfo is a variant of waitRedisWith which does not install any additional handlers.

waitRedisVerbose :: (MonadIO m, MonadMask m) => (String -> m ()) -> RetryPolicyM m -> ConnectInfo -> m Connection Source #

waitRedisVerbose outputHandler retryPolicy connectInfo is a variant of waitRedisVerboseFormat which catches all exceptions derived from SomeException and formats retry attempt information using defaultLogMsg before passing the resulting String to out.

waitRedisVerboseFormat :: forall e m. (MonadIO m, MonadMask m, Exception e) => (Bool -> e -> RetryStatus -> m ()) -> RetryPolicyM m -> ConnectInfo -> m Connection Source #

waitRedisVerboseFormat outputHandler retryPolicy connectInfo is a variant of waitRedisWith which installs an extra handler based on logRetries which passes status information for each retry attempt to outputHandler.

waitRedisWith :: (MonadIO m, MonadMask m) => [RetryStatus -> Handler m Bool] -> RetryPolicyM m -> ConnectInfo -> m Connection Source #

waitRedisWith extraHandlers retryPolicy connectInfo will attempt to connect to the Redis server using connectInfo and check that the server is ready to accept commands. If this check fails, retryPolicy is used to determine whether (and how often) this function should attempt to retry establishing the connection. By default, this function will retry after all exceptions (except for those given by skipAsyncExceptions). This behaviour may be customised with extraHandlers which are installed after skipAsyncExceptions, but before the default exception handler. The extraHandlers may also be used to report retry attempts to e.g. the standard output or a logger.