I have a task which will take around 20 – 30 seconds. I want this task to run immediately after a view is rendered. I want the output of this task to be stored in a session variable. What is the simplest way to do it rails 3.
To explain what i need exactly. I am showing a list of tweets to users (this is the view rendered) They have to go through them. I want a method to be invoked after this view is rendered which will take the same tweets and cluster them (20-30 seconds process). I should have the results of the clustering in the session so that i can display them in the next page.
How do I do this?
This is how I solved the problem
resquefor background tasks. I enqueued the task just before the render was called.It was not perfect but it was fast enough for a research feedback collection tool.