mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Tag sidekiq process with Rails app name [#463]
This commit is contained in:
parent
43ae7d8833
commit
c4d56ab27b
3 changed files with 20 additions and 6 deletions
|
@ -1,3 +1,12 @@
|
|||
HEAD
|
||||
-----------
|
||||
|
||||
- Add -g option so the procline better identifies a Sidekiq process, defaults to File.basename(Rails.root). [#486]
|
||||
|
||||
sidekiq 2.5.1 myapp [0 of 25 busy]
|
||||
|
||||
- Add splay to retry time so groups of failed jobs don't fire all at once. [#483]
|
||||
|
||||
2.5.1
|
||||
-----------
|
||||
|
||||
|
|
|
@ -126,6 +126,7 @@ module Sidekiq
|
|||
require 'sidekiq/rails'
|
||||
require File.expand_path("#{options[:require]}/config/environment.rb")
|
||||
::Rails.application.eager_load!
|
||||
options[:tag] ||= File.basename(::Rails.root)
|
||||
else
|
||||
require options[:require]
|
||||
end
|
||||
|
@ -164,7 +165,11 @@ module Sidekiq
|
|||
end
|
||||
|
||||
o.on '-t', '--timeout NUM', "Shutdown timeout" do |arg|
|
||||
opts[:timeout] = arg.to_i
|
||||
opts[:timeout] = Integer(arg)
|
||||
end
|
||||
|
||||
o.on '-g', '--tag TAG', "Process tag for procline" do |arg|
|
||||
opts[:tag] = arg
|
||||
end
|
||||
|
||||
o.on '-r', '--require [PATH|DIR]', "Location of Rails application with workers or file to require" do |arg|
|
||||
|
@ -172,7 +177,7 @@ module Sidekiq
|
|||
end
|
||||
|
||||
o.on '-c', '--concurrency INT', "processor threads to use" do |arg|
|
||||
opts[:concurrency] = arg.to_i
|
||||
opts[:concurrency] = Integer(arg)
|
||||
end
|
||||
|
||||
o.on '-P', '--pidfile PATH', "path to pidfile" do |arg|
|
||||
|
|
|
@ -27,7 +27,7 @@ module Sidekiq
|
|||
@busy = []
|
||||
@fetcher = Fetcher.new(current_actor, options[:queues], !!options[:strict])
|
||||
@ready = @count.times.map { Processor.new_link(current_actor) }
|
||||
procline
|
||||
procline(options[:tag] ? "#{options[:tag]} " : '')
|
||||
end
|
||||
|
||||
def stop(options={})
|
||||
|
@ -153,9 +153,9 @@ module Sidekiq
|
|||
@done
|
||||
end
|
||||
|
||||
def procline
|
||||
$0 = "sidekiq #{Sidekiq::VERSION} [#{@busy.size} of #{@count} busy]#{stopped? ? ' stopping' : ''}"
|
||||
after(5) { procline }
|
||||
def procline(tag)
|
||||
$0 = "sidekiq #{Sidekiq::VERSION} #{tag}[#{@busy.size} of #{@count} busy]#{stopped? ? ' stopping' : ''}"
|
||||
after(5) { procline(tag) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue