resque-loner 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.rubocop.yml +92 -0
- data/.simplecov +1 -0
- data/.travis.yml +12 -0
- data/CHANGELOG.markdown +11 -0
- data/Gemfile +4 -5
- data/README.markdown +4 -1
- data/Rakefile +13 -41
- data/lib/resque-ext/job.rb +9 -9
- data/lib/resque-ext/resque.rb +4 -9
- data/lib/resque-loner.rb +2 -1
- data/lib/resque-loner/helpers.rb +22 -9
- data/lib/resque-loner/legacy_helpers.rb +91 -0
- data/lib/resque-loner/unique_job.rb +23 -14
- data/lib/resque-loner/version.rb +1 -1
- data/resque-loner.gemspec +41 -32
- data/spec/loner_spec.rb +73 -51
- data/spec/spec_helper.rb +19 -3
- data/spec/support/redis_instance.rb +133 -0
- data/test/airbrake_test.rb +27 -0
- data/test/dump.rdb +0 -0
- data/test/job_hooks_test.rb +191 -52
- data/test/job_plugins_test.rb +33 -31
- data/test/plugin_test.rb +38 -26
- data/{spec/redis-test.conf → test/redis-test-cluster.conf} +4 -4
- data/test/resque-web_test.rb +23 -17
- data/test/resque_failure_redis_test.rb +23 -0
- data/test/resque_test.rb +56 -37
- data/test/test_helper.rb +58 -29
- data/test/worker_test.rb +311 -55
- metadata +157 -58
- data/init.rb +0 -1
- data/rails/init.rb +0 -1
- data/test/hoptoad_test.rb +0 -25
metadata
CHANGED
@@ -1,161 +1,260 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque-loner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.3.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jannis Hermanns
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-03-24 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: resque
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
requirement:
|
28
|
-
|
28
|
+
name: airbrake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: i18n
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: mocha
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: mock_redis
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
29
72
|
requirements:
|
30
|
-
- -
|
73
|
+
- - ">="
|
31
74
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0
|
75
|
+
version: '0'
|
33
76
|
type: :development
|
34
77
|
prerelease: false
|
35
|
-
version_requirements:
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
36
83
|
- !ruby/object:Gem::Dependency
|
37
84
|
name: rack-test
|
38
|
-
requirement:
|
39
|
-
none: false
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
40
86
|
requirements:
|
41
|
-
- -
|
87
|
+
- - ">="
|
42
88
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0
|
89
|
+
version: '0'
|
44
90
|
type: :development
|
45
91
|
prerelease: false
|
46
|
-
version_requirements:
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
47
111
|
- !ruby/object:Gem::Dependency
|
48
112
|
name: rspec
|
49
|
-
requirement:
|
50
|
-
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
121
|
requirements:
|
52
|
-
- -
|
122
|
+
- - ">="
|
53
123
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
55
132
|
type: :development
|
56
133
|
prerelease: false
|
57
|
-
version_requirements:
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
58
139
|
- !ruby/object:Gem::Dependency
|
59
|
-
name:
|
60
|
-
requirement:
|
61
|
-
none: false
|
140
|
+
name: simplecov
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
62
142
|
requirements:
|
63
|
-
- -
|
143
|
+
- - ">="
|
64
144
|
- !ruby/object:Gem::Version
|
65
|
-
version: 0
|
145
|
+
version: '0'
|
66
146
|
type: :development
|
67
147
|
prerelease: false
|
68
|
-
version_requirements:
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
69
153
|
- !ruby/object:Gem::Dependency
|
70
154
|
name: yajl-ruby
|
71
|
-
requirement:
|
72
|
-
none: false
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
73
156
|
requirements:
|
74
|
-
- -
|
157
|
+
- - ">="
|
75
158
|
- !ruby/object:Gem::Version
|
76
|
-
version: 0
|
159
|
+
version: '0'
|
77
160
|
type: :development
|
78
161
|
prerelease: false
|
79
|
-
version_requirements:
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
description: |
|
168
|
+
Makes sure that for special jobs, there can be only one job with the same
|
169
|
+
workload in one queue.
|
170
|
+
|
171
|
+
Example:
|
172
|
+
class CacheSweeper
|
173
|
+
include Resque::Plugins::UniqueJob
|
174
|
+
|
175
|
+
@queue = :cache_sweeps
|
176
|
+
|
177
|
+
def self.perform(article_id)
|
178
|
+
# Cache Me If You Can...
|
179
|
+
end
|
180
|
+
end
|
84
181
|
email:
|
85
182
|
- jannis@moviepilot.com
|
86
183
|
executables: []
|
87
184
|
extensions: []
|
88
185
|
extra_rdoc_files: []
|
89
186
|
files:
|
90
|
-
- .gitignore
|
187
|
+
- ".gitignore"
|
188
|
+
- ".rubocop.yml"
|
189
|
+
- ".simplecov"
|
190
|
+
- ".travis.yml"
|
91
191
|
- CHANGELOG.markdown
|
92
192
|
- Gemfile
|
93
193
|
- LICENSE
|
94
194
|
- README.markdown
|
95
195
|
- Rakefile
|
96
|
-
- init.rb
|
97
196
|
- lib/resque-ext/job.rb
|
98
197
|
- lib/resque-ext/resque.rb
|
99
198
|
- lib/resque-loner.rb
|
100
199
|
- lib/resque-loner/helpers.rb
|
200
|
+
- lib/resque-loner/legacy_helpers.rb
|
101
201
|
- lib/resque-loner/unique_job.rb
|
102
202
|
- lib/resque-loner/version.rb
|
103
|
-
- rails/init.rb
|
104
203
|
- resque-loner.gemspec
|
105
204
|
- spec/loner_spec.rb
|
106
|
-
- spec/redis-test.conf
|
107
205
|
- spec/spec_helper.rb
|
206
|
+
- spec/support/redis_instance.rb
|
108
207
|
- tasks/redis.rake
|
109
208
|
- tasks/resque.rake
|
110
|
-
- test/
|
209
|
+
- test/airbrake_test.rb
|
210
|
+
- test/dump.rdb
|
111
211
|
- test/job_hooks_test.rb
|
112
212
|
- test/job_plugins_test.rb
|
113
213
|
- test/plugin_test.rb
|
214
|
+
- test/redis-test-cluster.conf
|
114
215
|
- test/redis-test.conf
|
115
216
|
- test/resque-web_test.rb
|
217
|
+
- test/resque_failure_redis_test.rb
|
116
218
|
- test/resque_test.rb
|
117
219
|
- test/test_helper.rb
|
118
220
|
- test/worker_test.rb
|
119
221
|
homepage: http://github.com/jayniz/resque-loner
|
120
|
-
licenses:
|
222
|
+
licenses:
|
223
|
+
- MIT
|
224
|
+
metadata: {}
|
121
225
|
post_install_message:
|
122
226
|
rdoc_options: []
|
123
227
|
require_paths:
|
124
228
|
- lib
|
125
229
|
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
-
none: false
|
127
230
|
requirements:
|
128
|
-
- -
|
231
|
+
- - ">="
|
129
232
|
- !ruby/object:Gem::Version
|
130
233
|
version: '0'
|
131
|
-
segments:
|
132
|
-
- 0
|
133
|
-
hash: 399232762081660920
|
134
234
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
-
none: false
|
136
235
|
requirements:
|
137
|
-
- -
|
236
|
+
- - ">="
|
138
237
|
- !ruby/object:Gem::Version
|
139
238
|
version: '0'
|
140
|
-
segments:
|
141
|
-
- 0
|
142
|
-
hash: 399232762081660920
|
143
239
|
requirements: []
|
144
240
|
rubyforge_project: resque-loner
|
145
|
-
rubygems_version:
|
241
|
+
rubygems_version: 2.2.2
|
146
242
|
signing_key:
|
147
|
-
specification_version:
|
243
|
+
specification_version: 4
|
148
244
|
summary: Adds unique jobs to resque
|
149
245
|
test_files:
|
150
246
|
- spec/loner_spec.rb
|
151
|
-
- spec/redis-test.conf
|
152
247
|
- spec/spec_helper.rb
|
153
|
-
-
|
248
|
+
- spec/support/redis_instance.rb
|
249
|
+
- test/airbrake_test.rb
|
250
|
+
- test/dump.rdb
|
154
251
|
- test/job_hooks_test.rb
|
155
252
|
- test/job_plugins_test.rb
|
156
253
|
- test/plugin_test.rb
|
254
|
+
- test/redis-test-cluster.conf
|
157
255
|
- test/redis-test.conf
|
158
256
|
- test/resque-web_test.rb
|
257
|
+
- test/resque_failure_redis_test.rb
|
159
258
|
- test/resque_test.rb
|
160
259
|
- test/test_helper.rb
|
161
260
|
- test/worker_test.rb
|
data/init.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'rails/init.rb'
|
data/rails/init.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'resque-loner'
|
data/test/hoptoad_test.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'hoptoad_notifier'
|
5
|
-
rescue LoadError
|
6
|
-
warn "Install hoptoad_notifier gem to run Hoptoad tests."
|
7
|
-
end
|
8
|
-
|
9
|
-
if defined? HoptoadNotifier
|
10
|
-
context "Hoptoad" do
|
11
|
-
test "should be notified of an error" do
|
12
|
-
exception = StandardError.new("BOOM")
|
13
|
-
worker = Resque::Worker.new(:test)
|
14
|
-
queue = "test"
|
15
|
-
payload = {'class' => Object, 'args' => 66}
|
16
|
-
|
17
|
-
HoptoadNotifier.expects(:notify_or_ignore).with(
|
18
|
-
exception,
|
19
|
-
:parameters => {:payload_class => 'Object', :payload_args => '66'})
|
20
|
-
|
21
|
-
backend = Resque::Failure::Hoptoad.new(exception, worker, queue, payload)
|
22
|
-
backend.save
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|