Rails 4 +延迟工作 - 不断将调试代码写入生产日志

时间:2015-06-14 22:11:52

标签: ruby-on-rails debugging delayed-job

我第一次使用延迟工作,似乎工作正常。我开始关闭生产日志以解决另一个问题,并发现延迟的作业是使用调试代码不断更新生产日志。这是正常现象吗?我可以把它关掉吗?

    [2015-06-14T16:05:35.983383 #24767] DEBUG -- :   SQL (0.5ms)  UPDATE `delayed_jobs` SET `delayed_jobs`.`locked_at` = '2015-06-14 16:05:35', `delayed_jobs`.`locked_by` = 'delayed_job host:localhost pid:24767' WHERE ((run_at <= '2015-06-14 16:05:35.980823' AND (locked_at IS NULL OR locked_at < '2015-06-14 12:05:35.980900') OR locked_by = 'delayed_job host:localhost pid:24767') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 1
D, [2015-06-14T16:05:36.621786 #2864] DEBUG -- :   SQL (0.4ms)  UPDATE `delayed_jobs` SET `delayed_jobs`.`locked_at` = '2015-06-14 16:05:36', `delayed_jobs`.`locked_by` = 'delayed_job host:localhost pid:2864' WHERE ((run_at <= '2015-06-14 16:05:36.619634' AND (locked_at IS NULL OR locked_at < '2015-06-14 12:05:36.619699') OR locked_by = 'delayed_job host:localhost pid:2864') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 1
D, [2015-06-14T16:05:38.803207 #32414] DEBUG -- :   SQL (0.5ms)  UPDATE `delayed_jobs` SET `delayed_jobs`.`locked_at` = '2015-06-14 16:05:38', `delayed_jobs`.`locked_by` = 'delayed_job host:localhost pid:32414' WHERE ((run_at <= '2015-06-14 16:05:38.801308' AND (locked_at IS NULL OR locked_at < '2015-06-14 12:05:38.801378') OR locked_by = 'delayed_job host:localhost pid:32414') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 1
D, [2015-06-14T16:05:40.683621 #13040] DEBUG -- :   SQL (0.4ms)  UPDATE `delayed_jobs` SET `delayed_jobs`.`locked_at` = '2015-06-14 16:05:40', `delayed_jobs`.`locked_by` = 'delayed_job host:localhost pid:13040' WHERE ((run_at <= '2015-06-14 16:05:40.681734' AND (locked_at IS NULL OR locked_at < '2015-06-14 12:05:40.681791') OR locked_by = 'delayed_job host:localhost pid:13040') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 1
D, [2015-06-14T16:05:40.986701 #24767] DEBUG -- :   SQL (0.6ms)  UPDATE `delayed_jobs` SET `delayed_jobs`.`locked_at` = '2015-06-14 16:05:40', `delayed_jobs`.`locked_by` = 'delayed_job host:localhost pid:24767' WHERE ((run_at <= '2015-06-14 16:05:40.984123' AND (locked_at IS NULL OR locked_at < '2015-06-14 12:05:40.984213') OR locked_by = 'delayed_job host:localhost pid:24767') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 1
D, [2015-06-14T16:05:41.624208 #2864] DEBUG -- :   SQL (0.4ms)  UPDATE `delayed_jobs` SET `delayed_jobs`.`locked_at` = '2015-06-14 16:05:41', `delayed_jobs`.`locked_by` = 'delayed_job host:localhost pid:2864' WHERE ((run_at <= '2015-06-14 16:05:41.622350' AND (locked_at IS NULL OR locked_at < '2015-06-14 12:05:41.622408') OR locked_by = 'delayed_job host:localhost pid:2864') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 1
D, [2015-06-14T16:05:43.805954 #32414] DEBUG -- :   SQL (0.5ms)  UPDATE `delayed_jobs` SET `delayed_jobs`.`locked_at` = '2015-06-14 16:05:43', `delayed_jobs`.`locked_by` = 'delayed_job host:localhost pid:32414' WHERE ((run_at <= '2015-06-14 16:05:43.803737' AND (locked_at IS NULL OR locked_at < '2015-06-14 12:05:43.803805') OR locked_by = 'delayed_job host:localhost pid:32414') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 1
D, [2015-06-14T16:05:45.685733 #13040] DEBUG -- :   SQL (0.4ms)  UPDATE `delayed_jobs` SET `delayed_jobs`.`locked_at` = '2015-06-14 16:05:45', `delayed_jobs`.`locked_by` = 'delayed_job host:localhost pid:13040' WHERE ((run_at <= '2015-06-14 16:05:45.684133' AND (locked_at IS NULL OR locked_at < '2015-06-14 12:05:45.684179') OR locked_by = 'delayed_job host:localhost pid:13040') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 1
D, [2015-06-14T16:05:45.989291 #24767] DEBUG -- :   SQL (0.5ms)  UPDATE `delayed_jobs` SET `delayed_jobs`.`locked_at` = '2015-06-14 16:05:45', `delayed_jobs`.`locked_by` = 'delayed_job host:localhost pid:24767' WHERE ((run_at <= '2015-06-14 16:05:45.987317' AND (locked_at IS NULL OR locked_at < '2015-06-14 12:05:45.987369') OR locked_by = 'delayed_job host:localhost pid:24767') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 1
D, [2015-06-14T16:05:46.616535 #24767] DEBUG -- :    (0.3ms)  SELECT COUNT(*) FROM `delayed_jobs` WHERE (failed_at is not NULL)
D, [2015-06-14T16:05:46.617620 #24767] DEBUG -- :    (0.3ms)  SELECT COUNT(*) FROM `delayed_jobs` WHERE (locked_by is not NULL)
D, [2015-06-14T16:05:46.619464 #24767] DEBUG -- :    (0.4ms)  SELECT COUNT(*) AS count_all, priority AS priority FROM `delayed_jobs` WHERE (run_at <= '2015-06-14 16:05:46.618279' and failed_at is NULL) GROUP BY `delayed_jobs`.`priority`
D, 

延迟作业表通常为空,快速处理作业。

1 个答案:

答案 0 :(得分:0)

这是正常的,您必须将log_level中的config/environments/production.rb设置为:debug

将其更改为:info将不会使用延迟作业的调试注释来更新生产日志。