wai-eventsource: Do not Flush needlessly on ioToRepEventSource.

This commit is contained in:
Felipe Lessa 2012-08-20 11:34:50 -03:00
parent e0462b294c
commit 600fec4852

View File

@ -68,10 +68,13 @@ ioToRepEventSource initial act = do
let -- Get new events to be sent.
getEvents s = do
(evs, s') <- liftIO (act polyfill s)
let (builder, continue) = joinEvents evs []
C.yield (C.Chunk builder)
C.yield C.Flush
when continue (getEvents s')
case evs of
[] -> getEvents s'
_ -> do
let (builder, continue) = joinEvents evs []
C.yield (C.Chunk builder)
C.yield C.Flush
when continue (getEvents s')
-- Join all events in a single Builder. Returns @False@
-- when we the connection should be closed.