Ruby,延迟作业,延迟:后端:Activerecord

时间:2013-06-14 09:51:26

标签: ruby-on-rails delayed-job

我正在使用Something.delay.some_function()的延迟作业 我正在运行[Foreman] [1] Procfile来启动rails服务器和一个worker

web: bundle exec rails s
worker:  bundle exec rake jobs:work

我一直在终端看到这个,虽然我总是经营佣金工作:如果在工作期间发生了不好的事情,请说清楚。现在我没有工作岗位

irb(main):010:0> Delayed::Job.all
  Delayed::Backend::ActiveRecord::Job Load (0.7ms)  SELECT "delayed_jobs".* FROM "delayed_jobs" 
=> []

但我仍然在终端看到那些奇怪的东西。这是什么以及如何摆脱它?

11:47:01 rails_s.1     |   Delayed::Backend::ActiveRecord::Job Load (0.1ms)  SELECT "delayed_jobs".* FROM "delayed_jobs" WHERE ((run_at <= '2013-06-14 09:46:52.491892' AND (locked_at IS NULL OR locked_at < '2013-06-14 05:46:52.492124') OR locked_by = 'host:kik-VirtualBox pid:5010') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 5
11:47:01 rails_s.1     |   Delayed::Backend::ActiveRecord::Job Load (0.5ms)  SELECT "delayed_jobs".* FROM "delayed_jobs" WHERE ((run_at <= '2013-06-14 09:46:52.706307' AND (locked_at IS NULL OR locked_at < '2013-06-14 05:46:52.706499') OR locked_by = 'host:kik-VirtualBox pid:4654') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 5
11:47:01 rails_s.1     |   Delayed::Backend::ActiveRecord::Job Load (0.4ms)  SELECT "delayed_jobs".* FROM "delayed_jobs" WHERE ((run_at <= '2013-06-14 09:46:52.712781' AND (locked_at IS NULL OR locked_at < '2013-06-14 05:46:52.713010') OR locked_by = 'host:kik-VirtualBox pid:4313') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 5
11:47:01 rails_s.1     |   Delayed::Backend::ActiveRecord::Job Load (4.8ms)  SELECT "delayed_jobs".* FROM "delayed_jobs" WHERE ((run_at <= '2013-06-14 09:46:52.710021' AND (locked_at IS NULL OR locked_at < '2013-06-14 05:46:52.710261') OR locked_by = 'host:kik-VirtualBox pid:4622') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 5
11:47:01 rails_s.1     |   Delayed::Backend::ActiveRecord::Job Load (0.5ms)  SELECT "delayed_jobs".* FROM "delayed_jobs" WHERE ((run_at <= '2013-06-14 09:46:54.530083' AND (locked_at IS NULL OR locked_at < '2013-06-14 05:46:54.530318') OR locked_by = 'host:kik-VirtualBox pid:5307') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 5
11:47:01 rails_s.1     |   Delayed::Backend::ActiveRecord::Job Load (0.6ms)  SELECT "delayed_jobs".* FROM "delayed_jobs" WHERE ((run_at <= '2013-06-14 09:46:57.497068' AND (locked_at IS NULL OR locked_at < '2013-06-14 05:46:57.497275') OR locked_by = 'host:kik-VirtualBox pid:5010') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 5
11:47:01 rails_s.1     |   Delayed::Backend::ActiveRecord::Job Load (0.5ms)  SELECT "delayed_jobs".* FROM "delayed_jobs" WHERE ((run_at <= '2013-06-14 09:46:57.723823' AND (locked_at IS NULL OR locked_at < '2013-06-14 05:46:57.724071') OR locked_by = 'host:kik-VirtualBox pid:4313') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 5
11:47:01 rails_s.1     |   Delayed::Backend::ActiveRecord::Job Load (0.4ms)  SELECT "delayed_jobs".* FROM "delayed_jobs" WHERE ((run_at <= '2013-06-14 09:46:57.722732' AND (locked_at IS NULL OR locked_at < '2013-06-14 05:46:57.722934') OR locked_by = 'host:kik-VirtualBox pid:4654') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 5
11:47:01 rails_s.1     |   Delayed::Backend::ActiveRecord::Job Load (10.0ms)  SELECT "delayed_jobs".* FROM "delayed_jobs" WHERE ((run_at <= '2013-06-14 09:46:57.718190' AND (locked_at IS NULL OR locked_at < '2013-06-14 05:46:57.718443') OR locked_by = 'host:kik-VirtualBox pid:4622') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 5
11:47:01 rails_s.1     |   Delayed::Backend::ActiveRecord::Job Load (0.5ms)  SELECT "delayed_jobs".* FROM "delayed_jobs" WHERE ((run_at <= '2013-06-14 09:46:59.534770' AND (locked_at IS NULL OR locked_at < '2013-06-14 05:46:59.535003') OR locked_by = 'host:kik-VirtualBox pid:5307') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 5

提前致谢

1 个答案:

答案 0 :(得分:3)

延迟作业检查是否每隔一段时间就有新任务。只要rake jobs:work正在运行,您就会看到这些日志。简而言之 - 一切都很好!