-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kousa: Arch: Consider using Phoenix Tracker or Phoenix Presence instead of database #407
Comments
I'm all for moving this out of the db, if you have a good way to fetch your followers that are online. Right now it's easy because I can just do a join (https://github.com/benawad/dogehouse/blob/staging/kousa/lib/data-layer/follower_data.ex#L25), how would you go about querying that if we move it out of the db? |
I've actually never used tracker, I've only used Phoenix Presence, which builds on top of Tracker (but requires full Phoenix dependency), so here is my guess:
Note this is a "push" model, not a "pull" model. I might not be opposed to working on this to get a better understanding of how Tracker works. |
Also displaying when a user was last online is a thing which might just need to live in the db We could still add this to alert you when someone you follow comes online though |
Haha why not? I'm not sure how far this scales! A million followers is still only like 16 MB or so. You can push bigger content than that over erlang distribution (especially after OTP23 so there is no longer HOL blocking erlang/otp#2133). Everything after that is diffed, so no biggie.
That is the case. |
If last online is going to be in the db, then might as well keep isOnline and have tracker for websocket updates and not queries |
For keeping track of user online state. This information doesn't really need to live in the database, and having frequent read/write events to the db on this content will eventually hammer your database and cause responsiveness issues.
You don't need to pull in Phoenix as a dependency to use Phoenix Tracker, it exists as standalone library. https://hexdocs.pm/phoenix_pubsub/Phoenix.Tracker.html#content
The text was updated successfully, but these errors were encountered: