Open AndrewDryga opened 4 years ago
Our use case: we use Phoenix.PubSub to broadcast metrics to sockets that push data into charts in our application. To make sure that we don't pull and broadcast metrics that nobody is interested in we are using Tracker. When process subscribes for metrics we are tracking it's presence and check if anyone is subscribed for metric before pulling it from DB.
But we need to persist last event timestamp which we sent to processes so that if metrics server crashes it can recover and send remaining data while it was down. We can use presence metadata to track it but we would need to update lots of presences all the time.
ATM if you want to update all presences for a topic you need to call
Tracker.list/2
and thenTracker.update/5
for each item in the list.Tracker.update/5
implemented on top ofGenServer.call/3
which would be really expensive if we going to update lots of presences at a time.What do you feel about adding a
Tracker.update_metas/3
: