延迟的作业未从表中选择作业

编程入门 行业动态 更新时间:2024-10-21 20:41:17
本文介绍了延迟的作业未从表中选择作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在我当前的项目中,我正在使用延迟作业 gem在后台进行一些处理。在本地工作正常,但在生产作业中将其插入延迟的作业表中,但DJ并未从该DJ表中挑选少量作业。谁能想到延迟作业将如何从延迟作业表中提取作业。

In my current project I am doing some process in background by using Delayed Job gem. It's working fine in local but in production jobs are inserted into Delayed Job table but DJ not picking few jobs from that DJ table. Could any one have idea how Delayed Job will pick up jobs from Delayed Job table.

下面是我项目中的延迟作业代码:

Delayed :: Job.enqueue(ProposalJob.new(current_user,@proposal,request.host,params [:proposal] [:revision_notes], params [:proposal] [:close_date]),:queue =>'publishing')

我的作业配置延迟项目:

Delayed :: Worker.destroy_failed_jobs = false Delayed :: Worker.max_attempts = 3 Delayed :: Worker.max_run_time = 1.hours Delayed :: Worker.read_ahead = 10

推荐答案

延迟的工作不可能会选择某些工作而不会选择其他工作。 要么处理所有作业,要么不处理任何作业。如果它处理任何作业,则您的配置正确。

It's not possible that delayed job will pick some job and not pick other. Either it will process all job or not process any. If it process any job then your configuration is right.

由于 Delayed :: Worker.destroy_failed_jobs = false 此配置。如果您的任何作业失败三遍,那么它将不会从延迟的作业表中删除。因此,您可能会觉得此作业没有得到处理。

There might be issue due to Delayed::Worker.destroy_failed_jobs = false this configuration. if your any job fails three times then it will not get deleted from your delayed job table. Because of due to this you might feel that this jobs not get processed.

尝试使用 puts 。

您还可以尝试 https:// github。 com / resque / resque-scheduler ,这将提供可视化的方式来观看延迟的工作。

You can also try github/resque/resque-scheduler this will provide visual way to watch delayed jobs.

更多推荐

延迟的作业未从表中选择作业

本文发布于:2023-11-27 09:21:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637486.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:作业

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!