Asynchronous Process in Ruby on Rails

Asked

Viewed 403 times

1

I have a process that makes a match between the items[books, movies, music and games] of a particular user on Facebook with the items registered in my database. The problem is that the whole process takes around 18~25 seconds and would not want to leave the user waiting that time. I was thinking as soon as the user logs in with their Facebook account, shoot like a thread(I don’t even know if it’s possible in Ror) and redirect it to the root_path and when the process ended presented in a div some message.

How this should be done in Ruby On Rails, ie there is some Gem for that purpose or some good practice for that?

Thank you in advance..

  • Why not use ajax? It is already asynchronous (client-side), and on the server side represents only one more request.

  • I could even use Ajax, but I don’t know how it works when switching pages...

2 answers

3

There are several alternatives to back-end processes. Take a look at https://github.com/mperham/sidekiq believe q must solve and while the user waits you make calls in ajax to know if the thread has been completed. There is a Gem q only checks job status on sidekiq

0

  • @josuetex Please try to elaborate better your answer. While it can help those who asked the question, answers that contain only links are complicated because the URL can stop working at any time. If you want to understand a little better the reason of what I am writing access the question of the goal We want answers that contain only links?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.