You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.
delay:: (MonadIOm) =>Int->ConduitTiim()
delay t = awaitForever $\i -> liftIO (threadDelay t) >> yield i
range:: (MonadServerm) =>Empty->ConduitTOneIntVoidm()->m()
range _ sink = runConduit $ source 1.| delay 1_000_000.| filterC good .| mapC OneInt.| sink
where
good x = x <=5|| x >=15
source !x =do
liftIO $putStrLn$"Request "<>show x
yield x
source (x +1)
dataEmpty=Emptyderiving (Eq, Show, Generic)
deriving (ToSchemaArithmeticSchema "Empty", FromSchemaArithmeticSchema "Empty")
newtypeOneInt=OneInt{value::Int32}deriving (Eq, Show, Generic)
deriving (ToSchemaArithmeticSchema "OneInt", FromSchemaArithmeticSchema "OneInt")
What you will notice is that if the client stops listening (Ctrl+C) between 5 and 15, the stream will continue to work until it hits yield 16. This means that the stream can potentially run forever.
Essentially, I would like to know when the client has stopped listening (for any reason) - like here for Python, so that I know when to stop iterating (or better yet, it's done automatically).
Any ideas how to achieve this?
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Here is an example - a stream of numbers each second which should stop when the client stops listening.
What you will notice is that if the client stops listening (Ctrl+C) between 5 and 15, the stream will continue to work until it hits
yield 16
. This means that the stream can potentially run forever.Essentially, I would like to know when the client has stopped listening (for any reason) - like here for Python, so that I know when to stop iterating (or better yet, it's done automatically).
Any ideas how to achieve this?
The text was updated successfully, but these errors were encountered: