使用DataMapper作为延迟作业的后端时,我收到一个奇怪的错误。我目前正在使用以下宝石:
delayed_job, 2.1.0.pre2
delayed_job_data_mapper, 1.0.0.rc
根据此处的说明:
https://github.com/collectiveidea/delayed_job_data_mapper
我可以成功运行
Delayed::Worker.backend = :data_mapper
Delayed::Worker.backend.auto_upgrade!
以及将对象排入数据库。但是,当我尝试运行rake任务来运行一个worker时,worker会成功启动,但是当试图确定要拉出哪些作业时,会出现以下错误:
rake aborted!
expected a time or date, got Sun Feb 20 11:06:58 -0600 2011
以前似乎这是其他人在Github上报告的一个问题,但是没有解决方案,并且票证已经有几个月了:
https://github.com/collectiveidea/delayed_job_data_mapper/issues#issue/1
[更新]有人发布了Github问题的答案,我在这个问题的答案中重复了这个问题。
所以,我的问题是:有人解决了这个错误吗?或者我有不同的方法来做我不知道的DataMapper +延迟工作?
完整的佣金追踪:
expected a time or date, got Sun Feb 20 11:08:56 -0600 2011
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/duration.rb:94:in `sum'
/Library/Ruby/Gems/1.8/gems/delayed_job-2.1.0.pre2/lib/delayed/worker.rb:33:in `inject'
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/duration.rb:86:in `each'
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/duration.rb:86:in `inject'
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/duration.rb:86:in `sum'
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/duration.rb:69:in `until'
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/core_ext/time/calculations.rb:255:in `minus_without_coercion'
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/core_ext/time/calculations.rb:268:in `-'
/Library/Ruby/Gems/1.8/gems/delayed_job_data_mapper-1.0.0.rc/lib/delayed/backend/data_mapper.rb:35:in `find_available'
/Library/Ruby/Gems/1.8/gems/delayed_job-2.1.0.pre2/lib/delayed/worker.rb:172:in `reserve_and_run_one_job'
/Library/Ruby/Gems/1.8/gems/delayed_job-2.1.0.pre2/lib/delayed/worker.rb:101:in `work_off'
/Library/Ruby/Gems/1.8/gems/delayed_job-2.1.0.pre2/lib/delayed/worker.rb:100:in `times'
/Library/Ruby/Gems/1.8/gems/delayed_job-2.1.0.pre2/lib/delayed/worker.rb:100:in `work_off'
/Library/Ruby/Gems/1.8/gems/delayed_job-2.1.0.pre2/lib/delayed/worker.rb:75:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/Library/Ruby/Gems/1.8/gems/delayed_job-2.1.0.pre2/lib/delayed/worker.rb:74:in `start'
/Library/Ruby/Gems/1.8/gems/delayed_job-2.1.0.pre2/lib/delayed/worker.rb:71:in `loop'
/Library/Ruby/Gems/1.8/gems/delayed_job-2.1.0.pre2/lib/delayed/worker.rb:71:in `start'
谢谢!
答案 0 :(得分:1)
你需要要求 “active_support / core_ext”
我自己没有机会尝试这个,看看它是否有效,因为我最终选择了Resque,但我想我会继续发布这个答案以防其他人遇到这个问题而实际上想要一个解决方案。