Sha256: 1ba286e76ad33d9e5b858616cf8bc9d0e4de289538b62ffd41f04ccc2656fafb

Contents?: true

Size: 580 Bytes

Versions: 90

Compression:

Stored size: 580 Bytes

Contents

# frozen_string_literal: true

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

URL = 'http://worldtimeapi.org/api/timezone/Europe/Paris'

def get_time(results)
  loop do
    STDOUT << '!'
    if (res = HTTParty.get(URL))
      results << res
      STDOUT << '.'
    end
  rescue StandardError => e
    p e
  end
end

t0 = Time.now
results = []
move_on_after(3) do
  10.times do
    spin { get_time(results) }
  end
  supervise
  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

90 entries across 90 versions & 1 rubygems

Version Path
polyphony-1.6 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-1.5 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-1.4 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-1.3 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-1.2.1 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-1.2 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-1.1.1 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-1.1 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-1.0.2 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-1.0.1 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-1.0 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.99.6 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.99.5 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.99.4 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.99.3 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.99.2 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.99.1 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.99 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.98 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.97 examples/performance/thread-vs-fiber/httparty_multi.rb