Sha256: b7c6b5aad33471fbbac05aa2f4845f4aeef10852121cf7397953f7a4848ef959

Contents?: true

Size: 642 Bytes

Versions: 28

Compression:

Stored size: 642 Bytes

Contents

class NoResponseRack
  attr_reader :requests

  def initialize disconnected_mode
    @disconnected_mode = disconnected_mode

    @requests = []
    @sleeping_threads = []
  end

  def call(env)
    @requests.push(env)

    case @disconnected_mode
    when :elb_pool_empty
      @sleeping_threads << Thread.current
      sleep 65
      @sleeping_threads.delete Thread.current
      [504, {}, ['']]
    when :server_maintenance
      [200, {}, ['status_message=Atlas is down for maintenance.']]
    else
      [999, {}, [""]]
    end
  end

  def wakeup_sleeping_threads
    @sleeping_threads.each &:wakeup
    @sleeping_threads.clear
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
loco-rails-3.0.5 test/support/no_response_rack.rb
loco-rails-3.0.4 test/support/no_response_rack.rb
loco-rails-3.0.3 test/support/no_response_rack.rb
loco-rails-2.5.3 test/support/no_response_rack.rb
loco-rails-2.5.2 test/support/no_response_rack.rb
loco-rails-3.0.2 test/support/no_response_rack.rb
loco-rails-3.0.1 test/support/no_response_rack.rb
loco-rails-2.5.1 test/support/no_response_rack.rb
loco-rails-2.5.0 test/support/no_response_rack.rb
loco-rails-2.4.0 test/support/no_response_rack.rb
loco-rails-2.3.0 test/support/no_response_rack.rb
loco-rails-3.0.0 test/support/no_response_rack.rb
loco-rails-2.2.2 test/support/no_response_rack.rb
loco-rails-2.2.1 test/support/no_response_rack.rb
loco-rails-2.2.0 test/support/no_response_rack.rb
loco-rails-2.1.0 test/support/no_response_rack.rb
loco-rails-2.0.0 test/support/no_response_rack.rb
loco-rails-1.5.2 test/support/no_response_rack.rb
loco-rails-1.5.1 test/support/no_response_rack.rb
loco-rails-1.5.0 test/support/no_response_rack.rb