Created
December 17, 2015 00:58
-
-
Save ess/a1f8a7c21f34e5bf7bfc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def write_pid | |
if path = options[:pidfile] | |
pidfile = File.expand_path(path) | |
`logger -t sidekiq-runner "Writing #{::Process.pid} to #{pidfile}"` | |
File.open(pidfile, 'w') do |f| | |
f.puts ::Process.pid | |
end | |
sleep 1 | |
unless File.exist?(pidfile) | |
`logger -t 'sidekiq-runner' "#{pidfile} no longer exists after being written"` | |
raise "The pidfile doesn't exist after I wrote it" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment