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