Sha256: 6c3609c9a22f81b068ad4a689441b87aacb6ea587a98c71f074563ae3c0c5c09

Contents?: true

Size: 1.14 KB

Versions: 58

Compression:

Stored size: 1.14 KB

Contents

# The ruby 2.0 stdlib includes the following changes
# to avoid "can't add a new key into hash during iteration" errors.
#   https://github.com/ruby/ruby/commit/3c491a92f6fbfecc065f7687c51c7d6d52a38883
#   https://github.com/ruby/ruby/commit/7b18633804c606e8bcccfbb44e7d7b795e777ea6
# However, these changes were not backported to the 1.9.x stdlib.
# These errors are causing intermittent errors in the tests (frequently in jruby),
# so we're applying those changes here. This is loaded by all rackups using WEBrick.
if RUBY_VERSION =~ /^1\.9/
  require 'webrick/utils'
  module WEBrick
    module Utils
      class TimeoutHandler
        def initialize
          @timeout_info = Hash.new
          Thread.start{
            while true
              now = Time.now
              @timeout_info.keys.each{|thread|
                ary = @timeout_info[thread]
                next unless ary
                ary.dup.each{|info|
                  time, exception = *info
                  interrupt(thread, info.object_id, exception) if time < now
                }
              }
              sleep 0.5
            end
          }
        end
      end
    end
  end
end

Version data entries

58 entries across 56 versions & 4 rubygems

Version Path
excon-0.64.0 tests/rackups/webrick_patch.rb
excon-0.63.0 tests/rackups/webrick_patch.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/excon-0.62.0/tests/rackups/webrick_patch.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/excon-0.62.0/tests/rackups/webrick_patch.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/excon-0.62.0/tests/rackups/webrick_patch.rb
excon-0.62.0 tests/rackups/webrick_patch.rb
excon-0.61.0 tests/rackups/webrick_patch.rb
excon-0.60.0 tests/rackups/webrick_patch.rb
excon-0.59.0 tests/rackups/webrick_patch.rb
excon-0.58.0 tests/rackups/webrick_patch.rb
excon-0.57.1 tests/rackups/webrick_patch.rb
excon-0.57.0 tests/rackups/webrick_patch.rb
excon-0.56.0 tests/rackups/webrick_patch.rb
excon-0.55.0 tests/rackups/webrick_patch.rb
excon-0.54.0 tests/rackups/webrick_patch.rb
excon-0.53.0 tests/rackups/webrick_patch.rb
excon-0.52.0 tests/rackups/webrick_patch.rb
excon-0.51.0 tests/rackups/webrick_patch.rb
excon-0.50.1 tests/rackups/webrick_patch.rb
excon-0.50.0 tests/rackups/webrick_patch.rb