Sha256: 398f02a399eefb1847c7dab2338a1151df65944841fcccd10ff2e66a367dd07c
Contents?: true
Size: 559 Bytes
Versions: 18
Compression:
Stored size: 559 Bytes
Contents
#!/usr/bin/env ruby require 'async' require 'async/http/internet' Async do |parent| internet = Async::HTTP::Internet.new connection = nil child = parent.async do response = internet.get("https://utopia-falcon-heroku.herokuapp.com/beer/index") connection = response.connection response.each do |chunk| Async.logger.info(response) {chunk} end ensure Async.logger.info(response) {"Closing response..."} response&.close end parent.sleep(5) Async.logger.info(parent) {"Killing #{child}..."} child.stop ensure internet&.close end
Version data entries
18 entries across 18 versions & 1 rubygems