Ruby on Rails: How to run things in the background?

前端 未结 7 1944
暖寄归人
暖寄归人 2020-12-07 12:32

When a new resource is created and it needs to do some lengthy processing before the resource is ready, how do I send that processing away into the

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-07 13:13

    you ideally want to use an existing background job server, rather than writing your own. these will typically let you submit a job and give it a unique key; you can then use the key to periodically query the jobserver for the status of your job without blocking your webapp. here is a nice roundup of the various options out there.

提交回复
热议问题