1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

minor cleanups and doc fixes for 6.0

This commit is contained in:
Mike Perham 2019-08-28 09:59:28 -07:00
parent e552d4c383
commit 903448a9be
5 changed files with 17 additions and 22 deletions

View file

@ -713,7 +713,7 @@ module Sidekiq
##
# Enumerates the set of Sidekiq processes which are actively working
# right now. Each process send a heartbeat to Redis every 5 seconds
# right now. Each process sends a heartbeat to Redis every 5 seconds
# so this set should be relatively accurate, barring network partitions.
#
# Yields a Sidekiq::Process.

View file

@ -56,8 +56,7 @@ module Sidekiq
# touch the connection pool so it is created before we
# fire startup and start multithreading.
ver = Sidekiq.redis_info["redis_version"]
raise "You are using Redis v#{ver}, Sidekiq requires Redis v2.8.0 or greater" if ver < "2.8"
logger.warn "Sidekiq 6.0 requires Redis 4.0+, you are using Redis v#{ver}" if ver < "4"
raise "You are using Redis v#{ver}, Sidekiq requires Redis v4.0.0 or greater" if ver < "4"
# Since the user can pass us a connection pool explicitly in the initializer, we
# need to verify the size is large enough or else Sidekiq's performance is dramatically slowed.
@ -98,9 +97,13 @@ module Sidekiq
rescue Interrupt
logger.info "Shutting down"
launcher.stop
# Explicitly exit so busy Processor threads can't block
# process shutdown.
logger.info "Bye!"
# Explicitly exit so busy Processor threads won't block process shutdown.
#
# NB: slow at_exit handlers will prevent a timely exit if they take
# a while to run. If Sidekiq is getting here but the process isn't exiting,
# use the TTIN signal to determine where things are stuck.
exit(0)
end
end
@ -266,7 +269,7 @@ module Sidekiq
if !File.exist?(options[:require]) ||
(File.directory?(options[:require]) && !File.exist?("#{options[:require]}/config/application.rb"))
logger.info "=================================================================="
logger.info " Please point sidekiq to a Rails 4/5 application or a Ruby file "
logger.info " Please point Sidekiq to a Rails application or a Ruby file "
logger.info " to load your worker classes with -r [DIR|FILE]."
logger.info "=================================================================="
logger.info @parser
@ -287,7 +290,7 @@ module Sidekiq
end
o.on "-d", "--daemon", "Daemonize process" do |arg|
puts "WARNING: Daemonization mode was removed in Sidekiq 6.0, please use a proper process supervisor to start and manage your services"
puts "ERROR: Daemonization mode was removed in Sidekiq 6.0, please use a proper process supervisor to start and manage your services"
end
o.on "-e", "--environment ENV", "Application environment" do |arg|
@ -320,11 +323,11 @@ module Sidekiq
end
o.on "-L", "--logfile PATH", "path to writable logfile" do |arg|
puts "WARNING: Logfile redirection was removed in Sidekiq 6.0, Sidekiq will only log to STDOUT"
puts "ERROR: Logfile redirection was removed in Sidekiq 6.0, Sidekiq will only log to STDOUT"
end
o.on "-P", "--pidfile PATH", "path to pidfile" do |arg|
puts "WARNING: PID file creation was removed in Sidekiq 6.0, please use a proper process supervisor to start and manage your services"
puts "ERROR: PID file creation was removed in Sidekiq 6.0, please use a proper process supervisor to start and manage your services"
end
o.on "-V", "--version", "Print version and exit" do |arg|
@ -360,12 +363,6 @@ module Sidekiq
opts = opts.merge(opts.delete(environment.to_sym) || {})
parse_queues(opts, opts.delete(:queues) || [])
ns = opts.delete(:namespace)
if ns
# logger hasn't been initialized yet, puts is all we have.
puts("namespace should be set in your ruby initializer, is ignored in config file")
puts("config.redis = { :url => ..., :namespace => '#{ns}' }")
end
opts
end

View file

@ -5,10 +5,7 @@ require "sidekiq/fetch"
require "sidekiq/scheduled"
module Sidekiq
# The Launcher is a very simple Actor whose job is to
# start, monitor and stop the core Actors in Sidekiq.
# If any of these actors die, the Sidekiq process exits
# immediately.
# The Launcher starts the Manager and Poller threads and provides the process heartbeat.
class Launcher
include Util

View file

@ -124,8 +124,8 @@ module Sidekiq
REDIS_PROVIDER should be set to the name of the variable which contains the Redis URL, not a URL itself.
Platforms like Heroku will sell addons that publish a *_URL variable. You need to tell Sidekiq with REDIS_PROVIDER, e.g.:
REDIS_PROVIDER=REDISTOGO_URL
REDISTOGO_URL=redis://somehost.example.com:6379/4
REDIS_PROVIDER=REDISTOGO_URL
EOM
end

View file

@ -39,8 +39,9 @@ module Sidekiq
# Allows customization for this type of Worker.
# Legal options:
#
# retry - enable the RetryJobs middleware for this Worker, *true* to use the default
# or *Integer* count
# queue - name of queue to use for this job type, default *default*
# retry - enable retries for this Worker in case of error during execution,
# *true* to use the default or *Integer* count
# backtrace - whether to save any error backtrace in the retry payload to display in web UI,
# can be true, false or an integer number of lines to save, default *false*
#