Safe Haskell | None |
---|---|
Language | Haskell2010 |
- heartbeatOutputStream :: DiffTime -> a -> OutputStream a -> IO (OutputStream a)
- heartbeatInputStream :: DiffTime -> DiffTime -> InputStream a -> IO (InputStream a)
- data HeartbeatException = MissedHeartbeat DiffTime
Documentation
heartbeatOutputStream Source #
:: DiffTime | Heartbeat interval |
-> a | Heartbeat message |
-> OutputStream a | |
-> IO (OutputStream a) |
Send a message a
if nothing has been written on the stream for some interval of time.
Writing Nothing
to this OutputStream
is required for proper cleanup.
:: DiffTime | Heartbeat interval |
-> DiffTime | Grace time multiplier |
-> InputStream a | |
-> IO (InputStream a) |
Grace period = grace time multiplier x heartbeat interval Usually something like graceMultiplier = 2 is a good idea.
This throws a MissedHeartbeat
exception if a heartbeat is not
received within the grace period.
data HeartbeatException Source #
Exception to kill the heartbeat monitoring thread Heartbeat Exceptions carry the grace period, ie. the last time a message was received