* Dropped all references to Resque * Moved all jobs under app/workers since that's the Sidekiq convention * Renamed Jobs module to Worker to match new location * Adapted all jobs to Sidekiq * Replaced all enqueue calls with perform_async * Dropped Resque hacks from specs and features, replaced with sidekig/testing in RSpec and sidekig/testing/inline in Cucumber * Updated scripts to start a Sidekiq server * Inline Sidekiq sinatra app * Let Sidekiq create the actual Redis instance * Workaround already initialized constant warnings in service models * Resolved ToDo in one job definition by creating proper exception clases for some errors in receiving posts * Added sidekiq section to configuration to make it completly configurable to the user * Add Sidekiq middleware for clean backtraces * Delay HttpMulti retry to give offline pods a chance to come back up * Do not retry on GUID already taken and alike errors * Be graceful about deleted posts in GatherOEmbedData
50 lines
1.3 KiB
Ruby
50 lines
1.3 KiB
Ruby
require 'sidekiq_middlewares'
|
|
|
|
# Single process-mode
|
|
if AppConfig.environment.single_process_mode? && Rails.env != "test"
|
|
if Rails.env == 'production'
|
|
puts "WARNING: You are running Diaspora in production without Sidekiq"
|
|
puts " workers turned on. Please set single_process_mode to false in"
|
|
puts " config/diaspora.yml."
|
|
end
|
|
require 'sidekiq/testing/inline'
|
|
end
|
|
|
|
|
|
Sidekiq.configure_server do |config|
|
|
config.redis = AppConfig.get_redis_options
|
|
|
|
config.options = config.options.merge({
|
|
concurrency: AppConfig.environment.sidekiq.concurrency.to_i,
|
|
queues: %w{
|
|
socket_webfinger
|
|
photos
|
|
http_service
|
|
dispatch
|
|
mail
|
|
delete_account
|
|
receive_local
|
|
receive
|
|
receive_salmon
|
|
http
|
|
default
|
|
}
|
|
})
|
|
|
|
config.server_middleware do |chain|
|
|
chain.add SidekiqMiddlewares::CleanAndShortBacktraces
|
|
end
|
|
|
|
Sidekiq::Logging.initialize_logger AppConfig.sidekiq_log unless AppConfig.heroku?
|
|
|
|
# Set connection pool on Heroku
|
|
database_url = ENV['DATABASE_URL']
|
|
if(database_url)
|
|
ENV['DATABASE_URL'] = "#{database_url}?pool=#{AppConfig.environment.sidekiq.concurrency.get}"
|
|
ActiveRecord::Base.establish_connection
|
|
end
|
|
end
|
|
|
|
Sidekiq.configure_client do |config|
|
|
config.redis = AppConfig.get_redis_options
|
|
end
|