Created
October 28, 2014 15:52
-
-
Save ruseel/d64caf4fed9e603c9ae2 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
namespace :sidekiq do | |
def assert_process_running(pid) | |
begin | |
if pid == Process.waitpid(pid, Process::WNOHANG) then | |
raise "process killed" | |
end | |
end | |
puts "alive" | |
end | |
task :runnable do | |
pid = Process.spawn "bundle exec sidekiq" | |
WAIT_SEC = 5 | |
sleep WAIT_SEC; | |
3.times do | |
assert_process_running(pid) | |
sleep 1 | |
end | |
puts "sidekiq is runnalble for #{WAIT_SEC} sec" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment