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.
Best way to run a delayed job in browser
-
19-09-2022 - |
Pergunta
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?
Solução
Outras dicas
you can use the operation system scheduler
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow