network-wait: Lightweight library for waiting on networked services to become available.

[ library, mit, network ] [ Propose Tags ]

Please see the README on GitHub at https://github.com/mbg/network-wait#readme


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.1.0, 0.1.2.0, 0.2.0.0
Change log ChangeLog.md
Dependencies base (>=4.7 && <5), exceptions, network, retry [details]
License MIT
Copyright 2022 Michael B. Gale
Author Michael B. Gale
Maintainer github@michael-gale.co.uk
Category Network
Home page https://github.com/mbg/network-wait#readme
Bug tracker https://github.com/mbg/network-wait/issues
Source repo head: git clone https://github.com/mbg/network-wait
Uploaded by mbg at 2022-02-21T23:35:52Z
Distributions LTSHaskell:0.2.0.0, NixOS:0.2.0.0, Stackage:0.2.0.0
Downloads 859 total (25 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2022-02-22 [all 1 reports]

Readme for network-wait-0.1.0.0

[back to package description]

network-wait

A lightweight Haskell library for waiting on networked services to become available. This is useful if you are e.g. building a web application which relies on a database server to be available, but which may not be immediately available on application startup.

Example

All functions provided by this library work with retry policies from Control.Retry which provide good control over the retry behaviour. To wait for a PostgreSQL server to become available on the same machine:

import Control.Retry
import Network.Wait

main :: IO ()
main = do
    waitTcp retryPolicyDefault "localhost" "5432"
    putStrLn "Yay, the server is available!"

The haddock documentation for this library contains more examples.

See also

  • wait-for is a popular shell script with the same objectives as this library.
  • The port-utils package has some functions for waiting on TCP servers to become available, with a fixed timeout.