试图在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上运行不好。考虑到gem的受欢迎程度,我希望我在某个地方犯了一个错误,而不是它在MySQL上坏掉的可能性。
谢谢。
--
我在Postgres9.1中进行了测试,它运行良好。。。
我遇到了同样的问题,并发现了这个问题。现在看来你需要使用一个旧版本。他们昨天对活跃的记录宝石做了一些更新。
https://github.com/collectiveidea/delayed_job_active_record/issues/32