diaspora/config/initializers/resque.rb
Maxwell Salzberg bea76a4801 move the ugly type check into the ugly method, to keep all the ugly in
one place; restore listening to single process mode in resque; move the
exception handling to inside the method, rather than around the
intializer, and log when resque errors happen in development in single
process mode
2011-09-09 08:58:06 -07:00

23 lines
594 B
Ruby

require 'resque'
Resque::Plugins::Timeout.timeout = 120
if !ENV['SINGLE_PROCESS'] && AppConfig[:redis_url]
Resque.redis = Redis.new(:host => AppConfig[:redis_url], :port => 6379)
end
if ENV['SINGLE_PROCESS'] || AppConfig.single_process_mode
if Rails.env == 'production'
puts "WARNING: You are running Diaspora in production without Resque workers turned on. Please don't do this."
end
module Resque
def enqueue(klass, *args)
begin
klass.send(:perform, *args)
rescue Exception => e
Rails.logger(e.message)
nil
end
end
end
end