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-0.96 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.95 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.94 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.93 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.92 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.91 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.90 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.89 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.87 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.86 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.85 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.84.1 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.84 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.83 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.82 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.81.1 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.81 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.80 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.79 examples/performance/thread-vs-fiber/httparty_multi.rb
polyphony-0.78 examples/performance/thread-vs-fiber/httparty_multi.rb