I have to develop an API which does some map reduce jobs in the background and then return the results. Its a sinatra application with a Riak No-sql database. The issue is that the job takes around 5-10 minutes to run. And the request times out in that amount of time. What can be the best ways to run such kind of jobs in the background?

有帮助吗?

解决方案

Something like DelayedJob with a layer of something like Redis over the top (to keep track of job state), that is accessed by a unique route (your Sinatra API). Then have a different page (the web page for browser clients) that calls the API via AJAX, polling it periodically.

其他提示

you can use the operation system scheduler

windows task scheduler

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top