题
我只是启动并运行重新安排,并且在一项计划任务中正常工作。但是,当我在同一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:调度程序运行时,我将获得定期错误:
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,Ruby 1.9.2P136。
请注意,这两个类的表演方法都只能立即进行调试。
解决方案
好的,可能很糟糕的表格回答我自己的问题,抱歉...我发现了这个 所以线程 线索是添加:thread_safe = true load_resque:
Resque.redis = Redis.new(:host => config['host'], :port => config['port'], :thread_safe => true)
注意:这是Redis 2.1.1的,我以为我读过thread_safe现在是默认值。但是,我没有找到那篇文章...
不隶属于 StackOverflow