试图在MySQL环境中部署Rails 3应用程序,但是delayed_job
(v3.0.5)gem遇到了问题。db:migrate
似乎可以:
== CreateDelayedJobs: migrating ==============================================
-- create_table(:delayed_jobs, {:force=>true})
-> 0.0055s
-- add_index(:delayed_jobs, [:priority, :run_at], {:name=>"delayed_jobs_priority"})
-> 0.0040s
== CreateDelayedJobs: migrated (0.0096s) =====================================
但是尝试
script/delayed_job run
(很长的查询警告):delayed_job: process with pid 10713 started.
Mysql2::Error: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery': UPDATE `delayed_jobs` SET `locked_at` = '2013-02-11 10:43:13', `locked_by` = 'delayed_job host:dev pid:10713' WHERE `delayed_jobs`.`id` IN (SELECT id FROM `delayed_jobs` WHERE ((run_at <= '2013-02-11 10:43:13' AND (locked_at IS NULL OR locked_at < '2013-02-11 06:4 3:13') OR locked_by = 'delayed_job host:dev pid:10713') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 1 FOR UPDATE) AND ((run_at <= '2013-02-11 10:43:13' AND (l ocked_at IS NULL OR locked_at < '2013-02-11 06:43:13') OR locked_by = 'delayed_job host:dev pid:10713') AND failed_at IS NULL)
我可以确认这些表都在那里并且是空的。
我尝试过:MySQL 5.1和5.5以及各自的Percona和MariaDB。我在Linux和Windows计算机上都尝试过。
令我感到困惑的是,它在sqlite3上可以正常运行,但在MySQL上却不能。鉴于宝石的受欢迎程度,我希望我在某个地方犯了一个错误,而不是它在MySQL上崩溃的可能性。
谢谢。
-
我已经在Postgres 9.1中进行了测试,并且效果很好...
最佳答案
我遇到了同样的问题,并找到了这个。看来您现在需要使用旧版本。他们昨天对活动记录的宝石进行了一些更新。
https://github.com/collectiveidea/delayed_job_active_record/issues/32