问题描述
我的Rails应用程序中有几个调用外部Web API的过程-需要很长时间才能完成.我已经考虑过将它们移至后台进行处理.
I have a couple of processes in my Rails application that call to an external web API - and take a long time to finish. I've considered moving them to process in the background.
我希望能够向用户显示后台进程的进度(即进度条).
I would like to be able to show the user the progress of the background process (i.e. a progress bar).
首先,关于在Rails中使用jQuery实现进度条(与文件上传过程无关),是否有任何好的教程/学习资源?我已经看到了很多有关显示图形的资源-但是没有太多有关如何将图形更新与实际后台进程挂钩的信息.
First, are there any good tutorials/learning resources on implementing a progress bar with jQuery in Rails (not related to a file upload process)? I've seen a lot of resources on displaying the graphic - but not a lot of information on how to hook the graphic updating to the actual background process.
第二,当我考虑用于后台处理的各种宝石时,有没有一种可以更好地配合进度条(例如,延迟作业,Resque,Sidekiq)使用?
Second, as I consider the various gems for background processing, is there one that would work better with a progress bar (i.e. Delayed Jobs, Resque, Sidekiq)?
谢谢
推荐答案
我刚刚写了一篇有关使用 Sidekiq的博客文章. + SidekiqStatus + Bootstrap 主题进度条=来实现进度条.我知道这已经有一段时间了,但是希望其他人会发现它有用:
I just wrote a blog post about using Sidekiq + SidekiqStatus + Bootstrap theme progress bar = to implement a progress bar. I know it's been a while since this has been asked but hopefully, others will find it useful:
这篇关于Rails后台进程的进度条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!