尝试在 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 上损坏的可能性。
谢谢。
--
我已经在 Postgres 9.1 中进行了测试,它工作正常......