Fork me on GitHub
#pedestal
<
2017-06-14
>
bradford19:06:46

Hey, I'm seeing really strange behavior from SSE channels. The time it takes for something to go from SSE->Client increases linerally with the heartbeat interval. For instance, a message will take 2 seconds, then 4, then 6, then 8... etc indefinitely. I invoke my stream with

(sse/start-event-stream sse-stream-ready 1 (async/sliding-buffer 4) {:on-client-disconnect close-conn})
and put data into it with
(defn add-work-item [request ip]
  (async/put! event-ch {:name "request" :data (generate-string request)} ))

bradford19:06:50

This is sending 1-2 message at a time.

bradford19:06:30

Increasing the buffer size does not help.

bradford19:06:21

I can verify the 'put' completes (it executes the fn1 when I add one), but 'flushing' the buffer to the client seems to be delayed?

ddeaguiar20:06:32

Hrm, @bradford I can’t explain that behavior. I’m curious as to why but won’t be able to look into it any time soon 😞. I think you should reach out in the pedestal user group as well.

bradford20:06:17

Is the Pedestal SSE implementation such that data is only sent with heartbeats? Or is it continuous?

bradford20:06:25

I'm trying to read the code but I'm not quite sure

ddeaguiar20:06:35

IIRC, the heartbeats are intended to keep the connection alive but it’s been a while since I’ve looked at that code