Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails Creating new thread or Background process

I have an issue of Time out error when i click on the Export to Excel link in my application, due to heavy db transactions. I want to change this functionality to the background so that user able to move forward while background process runs. I want when user clicks on Export to Excel link background/new thread process runs and an email is sent to the user with a link to download a file. I want to know which is best way to achieve this Creating new thread or Background process?

Thanks in Advance

like image 235
Salil Avatar asked Oct 24 '22 11:10

Salil


1 Answers

You may want to use https://github.com/defunkt/resque or https://github.com/collectiveidea/delayed_job.

You can also watch:

http://railscasts.com/episodes/271-resque

http://railscasts.com/episodes/171-delayed-job-revised

http://railscasts.com/episodes/171-delayed-job (old one of above but free - but it is worth to buy a subscription)

like image 132
Sławosz Avatar answered Oct 27 '22 09:10

Sławosz