RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: Stefano1990
I as an admin have 1200 friends. Delaying the activity creation is the only real option even if it only takes a few seconds.
Why not just mark the model as 'deleted' instead of actually destroying it?
I had to so something like that too in my own app.
The simplest solution was to unload all the publishing of activities into a background job and cache the view of all activities. App response is around 150-200ms so I am happy. Activities are generally published within minutes so that is good enough.
I don't really like when a solution/gem outgrows the problem in complexity, plus callbacks are evil.
PS: I don't want to know how complex this would get if you also want comments on an activity to be published on the 'activity item'. So comment on 'A commented on picture of B' -> creates comment on picture of B, which is what I had to do in my app.
On a serious note I was surprised you didn't mention your own gem 'private_pub'. (For which you have some pull-requests. One is actually quite good.
Anyway back on topic. I am currently running faye/private_pub in production and it has been doing relatively well. That said, my loads are pathetic. At most we have 50 users simultaneously using the system. Sometimes faye causes the browser to slow down ridiculously, at least on Chrome on Mac. Also messages get lost sometimes but I am not terribly worried about that. It's not critical data I am handling.
That said it just feels to me like the web has not been made for things like this. It feels like a dirty hackfest having to integrate 4 different pieces of software to make one thing more or less run. And this shows when you look at the hacky nature of what rails has done with it. I am used to rails being nice to use (not so much anymore. Rails got bloated... 'rbenv exec bundle exec rails c' great. real nice to type right?) but that controller just looks... ugly.
So I hope there will be a 'definate' solution to this problem in the future but I don't hold my hopes up.