mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 23:54:16 +08:00
8ec7fd84fd
This commit introduces 3 queues for sidekiq "critical" for urgent jobs (weighted at 4x weight) "default" for standard jobs(weighted at 2x weight) "low" for less important jobs "critical jobs" Reset Password emails has been seperated to its own job Heartbeat which is required to keep sidekiq running Test email which needs to return real quick "low priority jobs" Notify mailing list Pull hotlinked images Update gravatar "default" All the rest Note: for people running sidekiq from command line use bin/sidekiq -q critical,4 -q default,2 -q low
39 lines
904 B
Ruby
39 lines
904 B
Ruby
require "demon/base"
|
|
|
|
class Demon::Sidekiq < Demon::Base
|
|
|
|
def self.prefix
|
|
"sidekiq"
|
|
end
|
|
|
|
private
|
|
|
|
def suppress_stdout
|
|
false
|
|
end
|
|
|
|
def suppress_stderr
|
|
false
|
|
end
|
|
|
|
def after_fork
|
|
STDERR.puts "Loading Sidekiq in process id #{Process.pid}"
|
|
require 'sidekiq/cli'
|
|
# CLI will close the logger, if we have one set we can be in big
|
|
# trouble, if STDOUT is closed in our process all sort of weird
|
|
# will ensue, resetting the logger ensures it will reinit correctly
|
|
# parent process is in charge of the file anyway.
|
|
Sidekiq::Logging.logger = nil
|
|
cli = Sidekiq::CLI.instance
|
|
cli.parse(["-c", GlobalSetting.sidekiq_workers.to_s, "-q", "critical,4", "-q", "default,2", "-q", "low"])
|
|
|
|
load Rails.root + "config/initializers/100-sidekiq.rb"
|
|
cli.run
|
|
rescue => e
|
|
STDERR.puts e.message
|
|
STDERR.puts e.backtrace.join("\n")
|
|
exit 1
|
|
end
|
|
|
|
end
|