我正在使用delayed_job_active_record 0.4.4运行delayed_job 3.0.5,使用MySQL DB在Rails 3.2.14上运行守护进程1.1.9。当我执行脚本/ delayed_job启动命令时,它似乎正常启动但没有创建pid文件。当我检查delayed_job日志时,其中没有错误,只是该进程正在启动的信息性消息。
但是,当我查看rails dev日志时,我会在SQL update命令后看到一个Unknown别名返回。这是我的日志中的一个剪辑,显示我两次启动delayed_job的位置。每次有一个新的pid,每次都给出相同的Unknown别名。
我很感激任何尝试解决这个问题的帮助。
bcrossland-mb:GameKultur bcrossland$ tail log/development.log
Delayed::Backend::ActiveRecord::Job Load (17.9ms) SELECT `delayed_jobs`.* FROM `delayed_jobs` WHERE `delayed_jobs`.`locked_at` = '2013-09-18 21:14:09' AND `delayed_jobs`.`locked_by` = 'delayed_job host:bcrossland-mb.local pid:13163' AND `delayed_jobs`.`failed_at` IS NULL LIMIT 1
Preference Load (0.5ms) SELECT `preferences`.* FROM `preferences` LIMIT 1
SQL (8.0ms) UPDATE `delayed_jobs` SET `locked_by` = NULL, `locked_at` = NULL WHERE `delayed_jobs`.`locked_by` = 'delayed_job host:bcrossland-mb.local pid:13163'
Unknown alias: 70352758094800
Connecting to database specified by database.yml
SQL (105.9ms) UPDATE `delayed_jobs` SET `locked_at` = '2013-09-18 21:36:58', `locked_by` = 'delayed_job host:bcrossland-mb.local pid:13564' WHERE ((run_at <= '2013-09-18 21:36:58' AND (locked_at IS NULL OR locked_at < '2013-09-18 17:36:58') OR locked_by = 'delayed_job host:bcrossland-mb.local pid:13564') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 1
Delayed::Backend::ActiveRecord::Job Load (1.1ms) SELECT `delayed_jobs`.* FROM `delayed_jobs` WHERE `delayed_jobs`.`locked_at` = '2013-09-18 21:36:58' AND `delayed_jobs`.`locked_by` = 'delayed_job host:bcrossland-mb.local pid:13564' LIMIT 1
Preference Load (0.6ms) SELECT `preferences`.* FROM `preferences` LIMIT 1
SQL (1.8ms) UPDATE `delayed_jobs` SET `locked_by` = NULL, `locked_at` = NULL WHERE `delayed_jobs`.`locked_by` = 'delayed_job host:bcrossland-mb.local pid:13564'
Unknown alias: 70352758094800
答案 0 :(得分:0)
我找到了。在delayed_jobs表中这是一个糟糕的工作。我有一个模块,每个模型都包含用于在运行模型时发送错误邮件的模块。它已经工作了多年但是在新模型上发送的错误消息是在ruby调用之前注入一个字符串,导致delayed_jobs崩溃。
- &70352758094800 !ruby/string
从示例中可以看出,&amp; 70352758094800正在ruby调用前注入,delayed_job将执行。这些数字与未知别名错误中列出的数字相匹配。由于字符串从未改变,我决定在表中搜索它并发现这个糟糕的工作。一旦我从延迟启动的表中删除了该作业,就没有问题。