使用 resque 批量插入
我目前正在尝试设置一个收集一堆对象的任务,然后对后台任务进行排队以将它们批量插入数据库......然后重复。
我一直在使用 resque 进行一些工作,看看是否可以进行设置。但是我很难弄清楚如何将对象数组传递到后台作业。
有人可以帮我吗?
编辑: 我可能应该提到我正在使用 gem "ar-extensions"
进行批量导入
I am currently trying to set up a task that collects a bunch of objects, and then queues a background task to batch insert them to a database.. and then repeats.
I have been working a little bit with resque, to see if i could get that set up.. But i am having a hard time figuring out how to pass an array of objects to a background job.
Can anyone help me out?
edit:
I should probably mention i am using gem "ar-extensions"
to do batch imports
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不应该传递对象,因为两者是不同的进程。我建议将对象代码集合移至后台作业。
You shouldn't pass object(s) since both are different processes. I would suggest to move the collection of objects code as well to background job.