Skip to content

Instantly share code, notes, and snippets.

@ruseel
Created October 28, 2014 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruseel/d64caf4fed9e603c9ae2 to your computer and use it in GitHub Desktop.
Save ruseel/d64caf4fed9e603c9ae2 to your computer and use it in GitHub Desktop.
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