mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Print Rails info at startup (#4383)
This commit is contained in:
parent
d02f1f1012
commit
2ecb6fa00b
2 changed files with 14 additions and 0 deletions
|
@ -38,6 +38,7 @@ module Sidekiq
|
|||
if environment == "development" && $stdout.tty? && Sidekiq.log_formatter.is_a?(Sidekiq::Logger::Formatters::Pretty)
|
||||
print_banner
|
||||
end
|
||||
logger.info "Booted Rails #{::Rails.version} application in #{environment} environment" if rails_app?
|
||||
|
||||
self_read, self_write = IO.pipe
|
||||
sigs = %w[INT TERM TTIN TSTP]
|
||||
|
@ -378,5 +379,9 @@ module Sidekiq
|
|||
[weight.to_i, 1].max.times { opts[:queues] << queue }
|
||||
opts[:strict] = false if weight.to_i > 0
|
||||
end
|
||||
|
||||
def rails_app?
|
||||
defined?(::Rails)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -322,6 +322,15 @@ describe Sidekiq::CLI do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
it 'prints rails info' do
|
||||
subject.stub(:environment, 'production') do
|
||||
subject.stub(:launch, nil) do
|
||||
subject.run
|
||||
end
|
||||
assert_includes @logdev.string, "Booted Rails #{::Rails.version} application in production environment"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'signal handling' do
|
||||
|
|
Loading…
Add table
Reference in a new issue