I have a webservice that processes user submitted data. The user doesn’t need to receive a response based on that data, he just needs to submit it. However, I do need to process that data. Currently the processing takes place directly as a response to the post action, and after the processing, it return a statuscode. This normally takes 0.5s – 2s, but sometimes much longer, when a user submits a lot of data.
Is it possible in Rails to spawn a new thread for processing that data, while returning the status code (and thus finishing the request for the user)?
Resque, Delayed Job, or Sidekiq should suit your needs.
You can find links to these three, and a couple more here: https://www.ruby-toolbox.com/categories/Background_Jobs