延迟的作业未从表中选择作业 [英] Delayed Job not picking job from table

查看:91
本文介绍了延迟的作业未从表中选择作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我当前的项目中,我正在使用延迟作业 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 https://github.com/resque/resque-scheduler this will provide visual way to watch delayed jobs.

这篇关于延迟的作业未从表中选择作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆