【发布时间】:2015-07-27 22:36:57
【问题描述】:
我想使用 Sidekiq 在后台运行报告而不锁定应用程序。我还希望视图显示报告页面。
它是这样的(但使用 Sidekiq):
When I go to the Admin/reports page
and I click on the 'View Report'
I see the report
还有,
When I go to the Admin/reports page
and I click on "Download CSV"
My browser downloads the report in CSV format
我知道如何对作业进行排队,但我不清楚一旦完成后如何更新视图。我知道这不是使用 Sidekiq 的教科书案例,但无法想象我是第一个尝试实现这种工作流程的人。
我设想让管理员用户等待几秒钟以准备好报告并开始下载/开始显示,并希望在他们等待时向他们显示一条临时消息。
有什么想法吗?
【问题讨论】:
-
您在问“如何使异步进程同步?”答:不让它异步。不要将其发送给 Sidekiq。
-
谢谢,我已经在考虑这种可能性,同时增加 Web 进程的数量(Heroku)。我想看看是否还有其他选择。编辑:考虑到你是 Sidekiq 的作者,我可能会接受你的建议 :)
标签: ajax ruby-on-rails-4 model-view-controller sidekiq