microget 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/microget.rb +9 -3
  3. data/microget.gemspec +3 -3
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87f3ed02ccdc53cbaeb27da5c3e75ac5fd59c183
4
- data.tar.gz: 7a7f074fc1e08bfdd4671c3d219517c6a245f820
3
+ metadata.gz: 631b5532bb2722b44a6e74512c6de077cbd35a01
4
+ data.tar.gz: 85d5b26d3c68d3360d94703d67b70d427b93d280
5
5
  SHA512:
6
- metadata.gz: c09a374a6665ee27dfee54f969cb92297480d37b1bfb4444d0a9d3a96b2c2c4d3875e47762accf5bdde27bfa26b1dc3b709bf29d16e31c1d7e1ab0f9550ac75f
7
- data.tar.gz: 02285a2a3f7b05bdf42e12a289a145d8d7f1d238cf3862fcc26dcfd9ca4c5dff982b6a2d9cd711212f36fb17f680c655d4132237d659baaa198aaad4ae41cadb
6
+ metadata.gz: 4445a448dbde63debda28ff7df665a584edfc85cb0ecdb6b4a0251f90a4587096ffbc781370f87a1fc7038f96c9d330ef3a2685e31ef7c7088c96a6189ce2496
7
+ data.tar.gz: 18b9ddb4c03a9fea12e8726d4595852c500c3ce9131cb94ba320e57b5927338954d6a4e7bfd49cabfce41fd754226f2020564350fea64194d10f5e65e92c04d0
@@ -5,7 +5,7 @@ require 'socket'
5
5
  module Microget
6
6
  autoload :ServerRunner, File.dirname(__FILE__) + '/microget/server_runner'
7
7
 
8
- VERSION = '1.1.1'
8
+ VERSION = '1.1.2'
9
9
 
10
10
  extend self
11
11
 
@@ -75,12 +75,18 @@ module Microget
75
75
  # starts to arrive
76
76
  return body_bytes_received unless yield(status_code, header_hash, '')
77
77
 
78
+ # We are using read_nonblock, and it allows a buffer to be passed in.
79
+ # The advantage of passing a buffer is that the same Ruby string is
80
+ # reused for all the reads, and only the string contents gets reallocated.
81
+ # We can reduce GC pressure this way.
82
+ body_buf = ''
83
+
78
84
  # ...and then just read the body, without any buffering, using a non-blocking read
79
85
  while !socket.eof?
80
86
  begin
81
- data = socket.read_nonblock(chunk_size)
87
+ data = socket.read_nonblock(chunk_size, body_buf)
82
88
  body_bytes_received += data.bytesize
83
- continue_reading = yield(status_code, header_hash, data)
89
+ continue_reading = yield(status_code, header_hash, body_buf)
84
90
  return body_bytes_received unless continue_reading
85
91
  rescue IO::WaitReadable
86
92
  IO.select([socket], [], SOCKET_TIMEOUT)
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: microget 1.1.1 ruby lib
5
+ # stub: microget 1.1.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "microget"
9
- s.version = "1.1.1"
9
+ s.version = "1.1.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Julik Tarkhanov"]
14
- s.date = "2016-01-03"
14
+ s.date = "2016-02-28"
15
15
  s.description = "Pedal-to-the-metal HTTP client for GET requests"
16
16
  s.email = "me@julik.nl"
17
17
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: microget
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-03 00:00:00.000000000 Z
11
+ date: 2016-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puma