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

merge master

This commit is contained in:
Mike Perham 2014-02-09 13:39:04 -08:00
commit 5ebcbb61ad
5 changed files with 66 additions and 4 deletions

View file

@ -7,12 +7,18 @@
Heroku users: `heroku config:set REDIS_PROVIDER=REDISTOGO_URL` Heroku users: `heroku config:set REDIS_PROVIDER=REDISTOGO_URL`
- Removed 'sidekiq/yaml\_patch', this was never documented or recommended. - Removed 'sidekiq/yaml\_patch', this was never documented or recommended.
- Removed the 'started' worker data, it originally provided compatibility with resque-web - Removed the 'started' worker data, it originally provided compatibility with resque-web
but overlaps the 'run_at' worker data. but overlaps the 'run\_at' worker data.
- Remove built-in error integration for Airbrake, Honeybadger, ExceptionNotifier and Exceptional. - Remove built-in error integration for Airbrake, Honeybadger, ExceptionNotifier and Exceptional.
Just update your error gem to the latest version to pick up Sidekiq support. Just update your error gem to the latest version to pick up Sidekiq support.
- Remove deprecated Sidekiq::Client.registered\_\* APIs - Remove deprecated Sidekiq::Client.registered\_\* APIs
- Remove deprecated support for the old Sidekiq::Worker#retries\_exhausted method. - Remove deprecated support for the old Sidekiq::Worker#retries\_exhausted method.
2.17.5
-----------
- A `USR2` signal will now reopen _all_ logs, using IO#reopen. Thus, instead of creating a new Logger object,
Sidekiq will now just update the existing Logger's file descriptor [#1163].
- Remove pidfile when shutting down if started with `-P` [#1470]
2.17.4 2.17.4
----------- -----------

View file

@ -73,6 +73,14 @@ case "$1" in
stop) stop)
stop stop
;; ;;
restart)
stop
while status > /dev/null
do
sleep 0.5
done
start
;;
status) status)
status status

View file

@ -108,7 +108,7 @@ module Sidekiq
when 'USR2' when 'USR2'
if Sidekiq.options[:logfile] if Sidekiq.options[:logfile]
Sidekiq.logger.info "Received USR2, reopening log file" Sidekiq.logger.info "Received USR2, reopening log file"
initialize_logger Sidekiq::Logging.reopen_logs
end end
when 'TTIN' when 'TTIN'
Thread.list.each do |thread| Thread.list.each do |thread|
@ -179,7 +179,7 @@ module Sidekiq
cfile = opts[:config_file] cfile = opts[:config_file]
opts = parse_config(cfile).merge(opts) if cfile opts = parse_config(cfile).merge(opts) if cfile
opts[:strict] = true if opts[:strict].nil? opts[:strict] = true if opts[:strict].nil?
options.merge!(opts) options.merge!(opts)
@ -313,6 +313,9 @@ module Sidekiq
File.open(path, 'w') do |f| File.open(path, 'w') do |f|
f.puts Process.pid f.puts Process.pid
end end
at_exit do
FileUtils.rm_f path
end
end end
end end

View file

@ -42,6 +42,51 @@ module Sidekiq
@logger = (log ? log : Logger.new('/dev/null')) @logger = (log ? log : Logger.new('/dev/null'))
end end
# This reopens ALL logfiles in the process that have been rotated
# using logrotate(8) (without copytruncate) or similar tools.
# A +File+ object is considered for reopening if it is:
# 1) opened with the O_APPEND and O_WRONLY flags
# 2) the current open file handle does not match its original open path
# 3) unbuffered (as far as userspace buffering goes, not O_SYNC)
# Returns the number of files reopened
def self.reopen_logs
to_reopen = []
append_flags = File::WRONLY | File::APPEND
ObjectSpace.each_object(File) do |fp|
begin
if !fp.closed? && fp.stat.file? && fp.sync && (fp.fcntl(Fcntl::F_GETFL) & append_flags) == append_flags
to_reopen << fp
end
rescue IOError, Errno::EBADF
end
end
nr = 0
to_reopen.each do |fp|
orig_st = begin
fp.stat
rescue IOError, Errno::EBADF
next
end
begin
b = File.stat(fp.path)
next if orig_st.ino == b.ino && orig_st.dev == b.dev
rescue Errno::ENOENT
end
begin
File.open(fp.path, 'a') { |tmpfp| fp.reopen(tmpfp) }
fp.sync = true
nr += 1
rescue IOError, Errno::EBADF
# not much we can do...
end
end
nr
end
def logger def logger
Sidekiq::Logging.logger Sidekiq::Logging.logger
end end

View file

@ -1,3 +1,3 @@
module Sidekiq module Sidekiq
VERSION = "2.17.4" VERSION = "2.17.5"
end end