typhoeus 0.1.22 → 0.1.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/typhoeus.rb +1 -1
  2. data/lib/typhoeus/hydra.rb +15 -5
  3. metadata +19 -8
@@ -14,7 +14,7 @@ require 'typhoeus/request'
14
14
  require 'typhoeus/hydra'
15
15
 
16
16
  module Typhoeus
17
- VERSION = "0.1.22"
17
+ VERSION = "0.1.23"
18
18
 
19
19
  def self.easy_object_pool
20
20
  @easy_objects ||= []
@@ -12,6 +12,7 @@ module Typhoeus
12
12
  @retrieved_from_cache = {}
13
13
  @queued_requests = []
14
14
  @running_requests = 0
15
+ @stubbed_request_count = 0
15
16
  end
16
17
 
17
18
  def self.hydra
@@ -56,12 +57,16 @@ module Typhoeus
56
57
  end
57
58
 
58
59
  def run
59
- @stubs.each do |m|
60
- m.requests.each do |request|
61
- m.response.request = request
62
- handle_request(request, m.response)
60
+ while @stubbed_request_count > 0
61
+ @stubs.each do |m|
62
+ while request = m.requests.shift
63
+ @stubbed_request_count -= 1
64
+ m.response.request = request
65
+ handle_request(request, m.response)
66
+ end
63
67
  end
64
68
  end
69
+
65
70
  @multi.perform
66
71
  @memoized_requests = {}
67
72
  @retrieved_from_cache = {}
@@ -94,7 +99,12 @@ module Typhoeus
94
99
 
95
100
  def assign_to_stub(request)
96
101
  m = @stubs.detect {|stub| stub.matches? request}
97
- m && m.add_request(request)
102
+ if m
103
+ m.add_request(request)
104
+ @stubbed_request_count += 1
105
+ else
106
+ nil
107
+ end
98
108
  end
99
109
  private :assign_to_stub
100
110
 
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typhoeus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.22
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 23
9
+ version: 0.1.23
5
10
  platform: ruby
6
11
  authors:
7
12
  - Paul Dix
@@ -14,14 +19,18 @@ default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: rack
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">"
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 9
30
+ - 0
23
31
  version: 0.9.0
24
- version:
32
+ type: :runtime
33
+ version_requirements: *id001
25
34
  description:
26
35
  email: paul@pauldix.net
27
36
  executables: []
@@ -76,18 +85,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
76
85
  requirements:
77
86
  - - ">="
78
87
  - !ruby/object:Gem::Version
88
+ segments:
89
+ - 0
79
90
  version: "0"
80
- version:
81
91
  required_rubygems_version: !ruby/object:Gem::Requirement
82
92
  requirements:
83
93
  - - ">="
84
94
  - !ruby/object:Gem::Version
95
+ segments:
96
+ - 0
85
97
  version: "0"
86
- version:
87
98
  requirements: []
88
99
 
89
100
  rubyforge_project:
90
- rubygems_version: 1.3.5
101
+ rubygems_version: 1.3.6
91
102
  signing_key:
92
103
  specification_version: 2
93
104
  summary: A library for interacting with web services (and building SOAs) at blinding speed.