我只是让 resque-schedule 启动并运行,它适用于一项计划任务。但是,当我在同一个 cron 计划上添加第二个时,它似乎在自己踩踏。这是我的 resque_schedule.yml 的样子:
email_subscription_notification:
cron: * * * * *
class: SubscriptionProcessor
args: test
description: Email Notifications
email_polling:
cron: * * * * *
class: EmailPollingProcessor
args: test
description: Email Polling
当我通过 rake resque:scheduler 运行时,我会收到周期性错误:
2011-03-15 17:43:00 Failed to enqueue EmailPollingProcessor:
Got '0' as initial reply byte. If you're running in a multi-threaded environment, make sure you pass the :thread_safe option when initializing the connection. If you're in a forking environment, such as Unicorn, you need to connect to Redis after forking.
如果我将时间表更改为只有一个或另一个,他们会玩得很好。如果我将 cron 计划更改为不重叠,它们运行良好。感谢您的任何帮助。OSx 10.6.6,红宝石 1.9.2p136。
请注意,这两个类的 perform 方法现在都只有用于调试的 puts。