Created
November 7, 2010 02:06
-
-
Save krobertson/665899 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'jruby/vm' | |
vms = [] | |
queue = 'background_tasks_LP' | |
instance_count = 30 | |
Signal.trap('HUP') { vms.map(&:join) } | |
instance_count.times do |i| | |
vms << JRuby::VM.spawn("-e RAILS_ROOT, RAILS_ENV = '#{File.expand_path(File.dirname(__FILE__) + '/..')}', 'demo'\nrequire RAILS_ROOT + '/config/boot'\nrequire RAILS_ROOT + '/config/environment'\nQueueable::Processor.start('background_tasks_HP', #{i+1})") | |
sleep 60 | |
end | |
loop do | |
sleep 10 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment