In ruby on rails application, if your request is taking too much time to process, you can make some part of the code to run in background.
In my application , I am sending notifications to owner,watch listers and trackers of a post, if there is any activity on the post. So when someone comments on the post, people will be getting notifications. I am using delayed jobs to generate notifications. But the problem here is inserts into delayed jobs. Whenever I comment on a post, all the inserts into the delayed job table takes long time, hence the response is coming too late.
class CommentsController < ApplicationController def comment @comment = Comment.new(params[:comment]) @comment.save @comment.send_messages end end
To make the inserts into delayed jobs in the background, I used Workling. Implementing Workling is very simple.
1. Install the Workling plugin
script/plugin install git://github.com/purzelrakete/workling.git
2. Create the…
View original post 55 more words