diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2009-12-30 22:55:52 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2009-12-30 22:55:52 -0500 |
commit | 5eb3ceca01d532e5303b4283c691adb953576ff4 (patch) | |
tree | c0fcb5cece2dd622f7e4e5deb320b3a0fe55a4af /railties/lib/rails/commands | |
parent | 7aabaac0f5ba108f917af2c65a79511694393b85 (diff) | |
download | rails-5eb3ceca01d532e5303b4283c691adb953576ff4.tar.gz rails-5eb3ceca01d532e5303b4283c691adb953576ff4.tar.bz2 rails-5eb3ceca01d532e5303b4283c691adb953576ff4.zip |
Orphan experiment no longer needed
Diffstat (limited to 'railties/lib/rails/commands')
-rwxr-xr-x | railties/lib/rails/commands/ncgi/tracker | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/railties/lib/rails/commands/ncgi/tracker b/railties/lib/rails/commands/ncgi/tracker deleted file mode 100755 index 4ca12d779b..0000000000 --- a/railties/lib/rails/commands/ncgi/tracker +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env ruby - -require 'drb' -require 'thread' - -def message(s) - $stderr.puts "tracker: #{s}" if ENV && ENV["DEBUG_GATEWAY"] -end - -class Tracker - include DRbUndumped - - def initialize(instances, socket_path) - @instances = instances - @socket = File.expand_path(socket_path) - @active = false - - @listeners = [] - @instances.times { @listeners << Mutex.new } - - message "using #{@listeners.length} listeners" - message "opening socket at #{@socket}" - - @service = DRb.start_service("drbunix://#{@socket}", self) - end - - def with_listener - message "listener requested" - - mutex = has_lock = index = nil - 3.times do - @listeners.each_with_index do |mutex, index| - has_lock = mutex.try_lock - break if has_lock - end - break if has_lock - sleep 0.05 - end - - if has_lock - message "obtained listener #{index}" - @active = true - begin yield index - ensure - mutex.unlock - message "released listener #{index}" - end - else - message "dropping request because no listeners are available!" - end - end - - def background(check_interval = nil) - if check_interval - loop do - sleep check_interval - message "Idle for #{check_interval}, shutting down" unless @active - @active = false - Kernel.exit 0 - end - else DRb.thread.join - end - end -end - -socket_path = ARGV.shift -instances = ARGV.shift.to_i -t = Tracker.new(instances, socket_path) -t.background(ARGV.first ? ARGV.shift.to_i : 90) |