Sha256: e68be4419b57ac894c4bdcc9d07c95658a64f2dc3f11f4e7bbb45f74374b80d6

Contents?: true

Size: 604 Bytes

Versions: 1

Compression:

Stored size: 604 Bytes

Contents

# frozen_string_literal: true

require 'bundler/setup'
require 'polyphony'
require 'httparty'

url = 'http://127.0.0.1:4411/?q=time'
results = []

t0 = Time.now
move_on_after(3) do
  supervise do |s|
    10.times do
      s.spin do
        loop do
          STDOUT << '!'
          if (result = HTTParty.get(url))
            results << result
            STDOUT << '.'
          end
        rescue StandardError => e
          p e
        end
      end
    end
  end
  puts 'done'
end
puts format(
  'got %<count>d (%<rate>0.1f reqs/s)',
  count: results.size,
  rate:  results.size / (Time.now - t0)
)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
polyphony-0.23 examples/io/httparty_multi.rb