Ruby on Rails Monday, February 26, 2018

Currently I have in my app I have cron tasks running that gather information and broadcasts it to the subscribers on the channels. On these taks I do view rendering before I broadcast the message to the client. But due to being a background cron task there is no user requesting the updated information and there might be no user listening to this broadcast and rendering is useless.
Therefore I'm looking (but could not find it in the documentation) if there is a way to check if there are clients listening on this channel/stream? It could save a lot of cpu. Now I send a very small message out and check the return value not 0 (means consumers are listening) but it should be more simple.
I could write code to track in the database if there are clients connected/disconnected on certain streams but the app already knows this (I assume?).

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f3554873-f236-4a97-9e59-e8697e7d8bfb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment