2011-03-16 31 views
2

我只是获得resque-schedule并运行,它可以正常工作与一个计划任务。然而,当我在同一个cron时间表上添加第二个时,它似乎是在踩着它自己。下面是我的resque_schedule.yml样子:resque-scheduler和重叠crons

email_subscription_notification: 
    cron: * * * * * 
    class: SubscriptionProcessor 
    args: test 
    description: Email Notifications 
email_polling: 
    cron: * * * * * 
    class: EmailPollingProcessor 
    args: test 
    description: Email Polling 

当我通过耙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。

注意这两个类的执行方法现在只需要进行调试。

回答

5

好,可能不好的形式回答我的问题,道歉......我发现这个SO thread和线索是,添加:thread_safe =真当我load_resque:

Resque.redis = Redis.new(:host => config['host'], :port => config['port'], :thread_safe => true) 

注:这与2.1的Redis .1我以为我读过thread_safe是现在的默认设置。但是,我没有找到那篇文章...

+3

如果你找到答案,回答你自己的问题是好的。这样,任何正在寻找相同问题解决方案的人都会找到答案,而不仅仅是一个没有答案的问题。 – Anomie 2011-03-17 13:27:01