开发者

rake jobs:work working fine. problem with script/delayed_job start

I am calling function with LoadData.send_later(:test). LoadData is my class and test is my method.

It's working fine while i am running rake jobs:work.

But when i am running script/delayed_job start or run that time delayed_job.log shows error like

TEastern Daylight Time: *** Starting job worker delayed_job host:KShah pid:5968
TEastern Daylight Time: * [Worker(delayed_job host:KSh开发者_如何学Cah pid:5968)] acquired lock on    LoadData.load_test_data_with_delayed_job
Could not load object for job: uninitialized constant LoadData
TEastern Daylight Time: * [JOB] delayed_job host:KShah pid:5968 completed after 0.0310
TEastern Daylight Time: 1 jobs processed at 10.6383 j/s, 0 failed ...

Any solution??


Try putting include LoadData in an initializer. I seem to remember DelayedJob including activerecord classes, notifiers etc, but not custom classes. Personally I'd put the class in your models directory. It's still dealing with data, even if it's not activerecord.


Try doing this:

Delayed::Job.enqueue LoadData.test

Also, a big gotcha that took me while to realize... if you make changes to the code restart rake jobs:work!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜