gpt4 book ai didi

mysql - 运行delayed_job时出现未知别名错误

转载 作者:行者123 更新时间:2023-11-30 01:17:46 26 4
gpt4 key购买 nike

我正在Rails 3.2.14 上使用MySQL DB 运行delayed_job 3.0.5、delayed_job_active_record 0.4.4 和守护进程1.1.9。当我执行 script/delayed_job start 命令时,它似乎正常启动,但没有创建 pid 文件。当我检查delayed_job日志时,其中没有错误,只是进程正在启动的信息性消息。

但是,当我查看 Rails 开发日志时,我看到 SQL 更新命令后返回了未知别名。这是我日志中的一个片段,显示了我两次启动它的位置。每次它都会获得一个新的 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

最佳答案

我找到了。延迟作业表中的作业很糟糕。我有一个每个模型都包含的模块,用于在运行模型时出现错误时发送邮件。它已经工作了很多年,但是在一个新模型上,发送的错误消息是在 ruby​​ 调用之前注入(inject)了一个字符串,导致delayed_jobs崩溃。

- &70352758094800 !ruby/string

正如您从示例中看到的,&70352758094800 被注入(inject)到要执行的 ruby​​ 调用之前。这些数字与“未知别名”错误中列出的数字相匹配。由于该字符串从未改变,我决定在表中搜索它并发现了这个糟糕的工作。一旦我从表中删除该作业,delayed_jobs 就没有问题地启动了。

关于mysql - 运行delayed_job时出现未知别名错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18883386/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com