curb_threadpool 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dea25e638cb62f03dc2279dfe54ffdccc953c0f5
4
- data.tar.gz: 830d96224e24f871ba618e9dfb2aae359bd66827
3
+ metadata.gz: 3766a607282a0efbcdb98cb8d56a237d464af3b5
4
+ data.tar.gz: 77f8a4edf28675a98cc54ccb383077c8f9c55a1e
5
5
  SHA512:
6
- metadata.gz: a4dca1c08fe2cfbab46425d8a6da4107af61f34b841ac2868d5a806954ce62398eb272352e68a40713a899c3d93989ac5511fa20311b97bf0f21651f87600b28
7
- data.tar.gz: 371902e8e65bcb3c2f5b37040e7d4b366872c8e2bef25e7d7fbb35674f2dc9f22353ed6a9b3788c32e9d76f38ab8f21ea7d9d55a8818ac1e92579cdde8d982b4
6
+ metadata.gz: 6ebca56edadac4c08fe23af5af40aaac7faf49b7a3c051d6d4c3e01a34fd73cd0cff083ae26b3fc11bf9d88d31bdfb0910079ded10c449594edead0670f9a027
7
+ data.tar.gz: edc760f64f477139da08390334b38bf9e9128d0c587d0161850df9928c434a0f07578075b72d0d58e6708d42b3158ebee7dfc824844a7f46b4aaa1476b272fcb
data/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+
2
+ # Curb ThreadPool Changelog
3
+
4
+ ## 0.6.0 - July 31, 2013
5
+
6
+ * Implemented HTTP POST method
7
+ * Added support for all HTTP methods supported by cURL: delete, get, head, post, put
8
+ * Added tests
data/Gemfile CHANGED
@@ -7,6 +7,7 @@ group :development do
7
7
  gem "bundler"
8
8
  gem "jeweler"
9
9
 
10
+ gem "micron", :github => "chetan/micron"
10
11
  gem "minitest", "<5.0"
11
12
  gem "webmock"
12
13
 
data/Rakefile CHANGED
@@ -25,11 +25,8 @@ Jeweler::Tasks.new do |gem|
25
25
  end
26
26
  Jeweler::RubygemsDotOrgTasks.new
27
27
 
28
- require 'rake/testtask'
29
- Rake::TestTask.new(:test) do |test|
30
- test.libs << 'lib' << 'test'
31
- test.pattern = 'test/**/test_*.rb'
32
- test.verbose = true
28
+ require "micron/rake"
29
+ Micron::Rake.new do |task|
33
30
  end
34
31
 
35
32
  if Object.const_defined? :Rcov
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.0
1
+ 0.6.1
@@ -2,14 +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: curb_threadpool 0.6.1 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
8
  s.name = "curb_threadpool"
8
- s.version = "0.6.0"
9
+ s.version = "0.6.1"
9
10
 
10
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
11
13
  s.authors = ["Chetan Sarva"]
12
- s.date = "2013-07-31"
14
+ s.date = "2014-03-18"
13
15
  s.description = "A multi-threaded worker pool for Curb"
14
16
  s.email = "chetan@pixelcop.net"
15
17
  s.extra_rdoc_files = [
@@ -17,6 +19,7 @@ Gem::Specification.new do |s|
17
19
  "README.md"
18
20
  ]
19
21
  s.files = [
22
+ "CHANGELOG.md",
20
23
  "Gemfile",
21
24
  "LICENSE",
22
25
  "README.md",
@@ -29,8 +32,7 @@ Gem::Specification.new do |s|
29
32
  ]
30
33
  s.homepage = "http://github.com/chetan/curb_threadpool"
31
34
  s.licenses = ["BSD"]
32
- s.require_paths = ["lib"]
33
- s.rubygems_version = "2.0.3"
35
+ s.rubygems_version = "2.2.2"
34
36
  s.summary = "A multi-threaded worker pool for Curb"
35
37
 
36
38
  if s.respond_to? :specification_version then
@@ -41,6 +43,7 @@ Gem::Specification.new do |s|
41
43
  s.add_development_dependency(%q<yard>, [">= 0"])
42
44
  s.add_development_dependency(%q<bundler>, [">= 0"])
43
45
  s.add_development_dependency(%q<jeweler>, [">= 0"])
46
+ s.add_development_dependency(%q<micron>, [">= 0"])
44
47
  s.add_development_dependency(%q<minitest>, ["< 5.0"])
45
48
  s.add_development_dependency(%q<webmock>, [">= 0"])
46
49
  s.add_development_dependency(%q<rcov>, [">= 0"])
@@ -54,6 +57,7 @@ Gem::Specification.new do |s|
54
57
  s.add_dependency(%q<yard>, [">= 0"])
55
58
  s.add_dependency(%q<bundler>, [">= 0"])
56
59
  s.add_dependency(%q<jeweler>, [">= 0"])
60
+ s.add_dependency(%q<micron>, [">= 0"])
57
61
  s.add_dependency(%q<minitest>, ["< 5.0"])
58
62
  s.add_dependency(%q<webmock>, [">= 0"])
59
63
  s.add_dependency(%q<rcov>, [">= 0"])
@@ -68,6 +72,7 @@ Gem::Specification.new do |s|
68
72
  s.add_dependency(%q<yard>, [">= 0"])
69
73
  s.add_dependency(%q<bundler>, [">= 0"])
70
74
  s.add_dependency(%q<jeweler>, [">= 0"])
75
+ s.add_dependency(%q<micron>, [">= 0"])
71
76
  s.add_dependency(%q<minitest>, ["< 5.0"])
72
77
  s.add_dependency(%q<webmock>, [">= 0"])
73
78
  s.add_dependency(%q<rcov>, [">= 0"])
@@ -114,6 +114,7 @@ class ThreadPool
114
114
  loop do
115
115
  break if @reqs.empty?
116
116
  req = @reqs.shift
117
+ break if req.nil? # can sometimes reach here due to a race condition. saw it a lot on travis
117
118
  client.url = req.uri
118
119
 
119
120
  args = ["http_#{req.method}"]
data/test/helper.rb CHANGED
@@ -9,7 +9,8 @@ rescue Bundler::BundlerError => e
9
9
  end
10
10
 
11
11
  require 'test_guard'
12
- TestGuard.load_simplecov()
12
+ require "minitest/unit" # require this first so we can stub properly
13
+ require "micron/minitest"
13
14
 
14
15
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
15
16
  $LOAD_PATH.unshift(File.dirname(__FILE__))
@@ -18,5 +19,3 @@ require 'webmock/minitest'
18
19
 
19
20
  class MiniTest::Unit::TestCase
20
21
  end
21
-
22
- MiniTest::Unit.autorun
@@ -44,6 +44,31 @@ class TestCurbThreadpool < MiniTest::Unit::TestCase
44
44
  end
45
45
  end
46
46
 
47
+ def test_get_multiple_race_condition
48
+ # race condition with multiple threads looking for more work
49
+
50
+ @pool = Curl::ThreadPool.new(10)
51
+ urls = [@url]*100
52
+
53
+ 10.times do |i|
54
+
55
+ rets = []
56
+ urls.size.times do
57
+ @i += 1
58
+ rets << { :status => 200, :body => @i }
59
+ end
60
+ stub_request(:get, "http://www.google.com/").to_return { rets.shift }
61
+
62
+ ret = @pool.get(urls)
63
+ assert ret
64
+ assert_equal urls.size, ret.size
65
+ ret.sort.each_with_index do |r, idx|
66
+ assert_equal idx+1+(urls.size*i), r
67
+ end
68
+
69
+ end
70
+ end
71
+
47
72
  def test_get_nil
48
73
  pool = Curl::ThreadPool.new
49
74
  ret = pool.get([])
metadata CHANGED
@@ -1,181 +1,195 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: curb_threadpool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chetan Sarva
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-31 00:00:00.000000000 Z
11
+ date: 2014-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curb
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: yard
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: jeweler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: micron
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: minitest
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - <
87
+ - - "<"
74
88
  - !ruby/object:Gem::Version
75
89
  version: '5.0'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - <
94
+ - - "<"
81
95
  - !ruby/object:Gem::Version
82
96
  version: '5.0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: webmock
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - '>='
101
+ - - ">="
88
102
  - !ruby/object:Gem::Version
89
103
  version: '0'
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - '>='
108
+ - - ">="
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: rcov
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - '>='
115
+ - - ">="
102
116
  - !ruby/object:Gem::Version
103
117
  version: '0'
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - '>='
122
+ - - ">="
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: simplecov
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
- - - '>='
129
+ - - ">="
116
130
  - !ruby/object:Gem::Version
117
131
  version: '0'
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
- - - '>='
136
+ - - ">="
123
137
  - !ruby/object:Gem::Version
124
138
  version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: test_guard
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
- - - '>='
143
+ - - ">="
130
144
  - !ruby/object:Gem::Version
131
145
  version: '0'
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
- - - '>='
150
+ - - ">="
137
151
  - !ruby/object:Gem::Version
138
152
  version: '0'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: rb-inotify
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
- - - '>='
157
+ - - ">="
144
158
  - !ruby/object:Gem::Version
145
159
  version: '0'
146
160
  type: :development
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
- - - '>='
164
+ - - ">="
151
165
  - !ruby/object:Gem::Version
152
166
  version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: rb-fsevent
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
- - - '>='
171
+ - - ">="
158
172
  - !ruby/object:Gem::Version
159
173
  version: '0'
160
174
  type: :development
161
175
  prerelease: false
162
176
  version_requirements: !ruby/object:Gem::Requirement
163
177
  requirements:
164
- - - '>='
178
+ - - ">="
165
179
  - !ruby/object:Gem::Version
166
180
  version: '0'
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: rb-fchange
169
183
  requirement: !ruby/object:Gem::Requirement
170
184
  requirements:
171
- - - '>='
185
+ - - ">="
172
186
  - !ruby/object:Gem::Version
173
187
  version: '0'
174
188
  type: :development
175
189
  prerelease: false
176
190
  version_requirements: !ruby/object:Gem::Requirement
177
191
  requirements:
178
- - - '>='
192
+ - - ">="
179
193
  - !ruby/object:Gem::Version
180
194
  version: '0'
181
195
  description: A multi-threaded worker pool for Curb
@@ -186,6 +200,7 @@ extra_rdoc_files:
186
200
  - LICENSE
187
201
  - README.md
188
202
  files:
203
+ - CHANGELOG.md
189
204
  - Gemfile
190
205
  - LICENSE
191
206
  - README.md
@@ -205,17 +220,17 @@ require_paths:
205
220
  - lib
206
221
  required_ruby_version: !ruby/object:Gem::Requirement
207
222
  requirements:
208
- - - '>='
223
+ - - ">="
209
224
  - !ruby/object:Gem::Version
210
225
  version: '0'
211
226
  required_rubygems_version: !ruby/object:Gem::Requirement
212
227
  requirements:
213
- - - '>='
228
+ - - ">="
214
229
  - !ruby/object:Gem::Version
215
230
  version: '0'
216
231
  requirements: []
217
232
  rubyforge_project:
218
- rubygems_version: 2.0.3
233
+ rubygems_version: 2.2.2
219
234
  signing_key:
220
235
  specification_version: 4
221
236
  summary: A multi-threaded worker pool for Curb