qe 0.3.5 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +54 -52
- data/README.md +17 -1
- data/lib/qe/sidekiq.rb +2 -2
- data/lib/qe/version.rb +1 -1
- data/lib/qe/worker/class_methods.rb +6 -0
- data/spec/qe/sidekiq_spec.rb +27 -3
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2b51561f2d0b2049401a673a8d2742b81afa42e
|
4
|
+
data.tar.gz: 042ff83f3a95c09ee581eea21b82793304e19857
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2fa0a4118dd9a201648aff7fa0a82e503fad9ae6f51441d1954e1fa3d6d68fa0630289758c0b05b13cb8e00434bae30b50d48c93aa994cc5af814e42ca85b72
|
7
|
+
data.tar.gz: ef8a1bcb96c133cabf80132b141f13bdeb3d7ef6ce03041c6b854a6ad693b51082f01641f5650ea898bb4850c3dcb456068544e8bb9ac586fb39110b23e1eaa4
|
data/Gemfile.lock
CHANGED
@@ -1,90 +1,91 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
qe (0.
|
4
|
+
qe (0.4.0)
|
5
5
|
activesupport
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (4.
|
11
|
-
activesupport (= 4.
|
10
|
+
activemodel (4.2.0)
|
11
|
+
activesupport (= 4.2.0)
|
12
12
|
builder (~> 3.1)
|
13
|
-
activerecord (4.
|
14
|
-
activemodel (= 4.
|
15
|
-
activesupport (= 4.
|
16
|
-
arel (~>
|
17
|
-
activesupport (4.
|
18
|
-
i18n (~> 0.
|
13
|
+
activerecord (4.2.0)
|
14
|
+
activemodel (= 4.2.0)
|
15
|
+
activesupport (= 4.2.0)
|
16
|
+
arel (~> 6.0)
|
17
|
+
activesupport (4.2.0)
|
18
|
+
i18n (~> 0.7)
|
19
19
|
json (~> 1.7, >= 1.7.7)
|
20
20
|
minitest (~> 5.1)
|
21
|
-
thread_safe (~> 0.
|
21
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
22
22
|
tzinfo (~> 1.1)
|
23
|
-
arel (
|
24
|
-
awesome_print (1.
|
25
|
-
backburner (0.4.
|
23
|
+
arel (6.0.0)
|
24
|
+
awesome_print (1.6.1)
|
25
|
+
backburner (0.4.6)
|
26
26
|
beaneater (~> 0.3.1)
|
27
27
|
dante (~> 0.1.5)
|
28
|
-
beaneater (0.3.
|
28
|
+
beaneater (0.3.3)
|
29
29
|
builder (3.2.2)
|
30
|
-
celluloid (0.
|
31
|
-
timers (~>
|
30
|
+
celluloid (0.16.0)
|
31
|
+
timers (~> 4.0.0)
|
32
32
|
coderay (1.1.0)
|
33
|
-
connection_pool (2.
|
33
|
+
connection_pool (2.1.1)
|
34
34
|
dante (0.1.5)
|
35
|
-
delayed_job (4.0.
|
36
|
-
activesupport (>= 3.0, <
|
37
|
-
delayed_job_active_record (4.0.
|
38
|
-
activerecord (>= 3.0, <
|
35
|
+
delayed_job (4.0.6)
|
36
|
+
activesupport (>= 3.0, < 5.0)
|
37
|
+
delayed_job_active_record (4.0.3)
|
38
|
+
activerecord (>= 3.0, < 5.0)
|
39
39
|
delayed_job (>= 3.0, < 4.1)
|
40
40
|
diff-lcs (1.2.5)
|
41
|
-
|
42
|
-
|
41
|
+
hitimes (1.2.2)
|
42
|
+
i18n (0.7.0)
|
43
|
+
json (1.8.2)
|
43
44
|
method_source (0.8.2)
|
44
|
-
minitest (5.
|
45
|
+
minitest (5.5.1)
|
45
46
|
mono_logger (1.1.0)
|
46
47
|
multi_json (1.10.1)
|
47
|
-
pry (0.10.
|
48
|
+
pry (0.10.1)
|
48
49
|
coderay (~> 1.1.0)
|
49
50
|
method_source (~> 0.8.1)
|
50
51
|
slop (~> 3.4)
|
51
52
|
qu (0.2.0)
|
52
53
|
multi_json
|
53
|
-
rack (1.
|
54
|
+
rack (1.6.0)
|
54
55
|
rack-protection (1.5.3)
|
55
56
|
rack
|
56
|
-
rake (10.
|
57
|
-
redis (3.0
|
58
|
-
redis-namespace (1.
|
59
|
-
redis (~> 3.0.4)
|
57
|
+
rake (10.4.2)
|
58
|
+
redis (3.2.0)
|
59
|
+
redis-namespace (1.5.1)
|
60
|
+
redis (~> 3.0, >= 3.0.4)
|
60
61
|
resque (1.25.2)
|
61
62
|
mono_logger (~> 1.0)
|
62
63
|
multi_json (~> 1.0)
|
63
64
|
redis-namespace (~> 1.3)
|
64
65
|
sinatra (>= 0.9.2)
|
65
66
|
vegas (~> 0.1.2)
|
66
|
-
resque-scheduler (
|
67
|
+
resque-scheduler (4.0.0)
|
67
68
|
mono_logger (~> 1.0)
|
68
69
|
redis (~> 3.0)
|
69
70
|
resque (~> 1.25)
|
70
|
-
rufus-scheduler (~>
|
71
|
-
rspec (3.
|
72
|
-
rspec-core (~> 3.
|
73
|
-
rspec-expectations (~> 3.
|
74
|
-
rspec-mocks (~> 3.
|
75
|
-
rspec-core (3.
|
76
|
-
rspec-support (~> 3.
|
77
|
-
rspec-expectations (3.
|
71
|
+
rufus-scheduler (~> 3.0)
|
72
|
+
rspec (3.1.0)
|
73
|
+
rspec-core (~> 3.1.0)
|
74
|
+
rspec-expectations (~> 3.1.0)
|
75
|
+
rspec-mocks (~> 3.1.0)
|
76
|
+
rspec-core (3.1.7)
|
77
|
+
rspec-support (~> 3.1.0)
|
78
|
+
rspec-expectations (3.1.2)
|
78
79
|
diff-lcs (>= 1.2.0, < 2.0)
|
79
|
-
rspec-support (~> 3.
|
80
|
-
rspec-mocks (3.
|
81
|
-
rspec-support (~> 3.
|
82
|
-
rspec-support (3.
|
83
|
-
rufus-scheduler (
|
84
|
-
tzinfo
|
85
|
-
sidekiq (3.1
|
86
|
-
celluloid (>= 0.
|
87
|
-
connection_pool (>= 2.
|
80
|
+
rspec-support (~> 3.1.0)
|
81
|
+
rspec-mocks (3.1.3)
|
82
|
+
rspec-support (~> 3.1.0)
|
83
|
+
rspec-support (3.1.2)
|
84
|
+
rufus-scheduler (3.0.9)
|
85
|
+
tzinfo
|
86
|
+
sidekiq (3.3.1)
|
87
|
+
celluloid (>= 0.16.0)
|
88
|
+
connection_pool (>= 2.1.1)
|
88
89
|
json
|
89
90
|
redis (>= 3.0.6)
|
90
91
|
redis-namespace (>= 1.3.1)
|
@@ -92,12 +93,13 @@ GEM
|
|
92
93
|
rack (~> 1.4)
|
93
94
|
rack-protection (~> 1.4)
|
94
95
|
tilt (~> 1.3, >= 1.3.4)
|
95
|
-
slop (3.
|
96
|
-
sqlite3 (1.3.
|
96
|
+
slop (3.6.0)
|
97
|
+
sqlite3 (1.3.10)
|
97
98
|
thread_safe (0.3.4)
|
98
99
|
tilt (1.4.1)
|
99
|
-
timers (
|
100
|
-
|
100
|
+
timers (4.0.1)
|
101
|
+
hitimes
|
102
|
+
tzinfo (1.2.2)
|
101
103
|
thread_safe (~> 0.1)
|
102
104
|
vegas (0.1.11)
|
103
105
|
rack (>= 1.0.0)
|
data/README.md
CHANGED
@@ -184,6 +184,23 @@ If the `mailer()` method isn't defined, the `Qe::ActionMailer::AbstractMethodErr
|
|
184
184
|
|
185
185
|
If the `:mail` option isn't defined, the `Qe::ActionMailer::MissingMailNameError` exception will be raised.
|
186
186
|
|
187
|
+
### Sidekiq
|
188
|
+
|
189
|
+
You can set Sidekiq options by using the method `Sidekiq::Worker.options`.
|
190
|
+
|
191
|
+
```ruby
|
192
|
+
require 'qe/sidekiq'
|
193
|
+
|
194
|
+
class NonRetryableWorker
|
195
|
+
include Qe::Worker
|
196
|
+
options retry: false
|
197
|
+
|
198
|
+
def perform
|
199
|
+
# do something...
|
200
|
+
end
|
201
|
+
end
|
202
|
+
```
|
203
|
+
|
187
204
|
### Development support
|
188
205
|
|
189
206
|
Qe comes with development support. Instead of starting up workers on development environment, you can use the `Qe::Immediate` adapter, which executes your worker right away!
|
@@ -222,7 +239,6 @@ describe "Enqueuing a job" do
|
|
222
239
|
end
|
223
240
|
```
|
224
241
|
|
225
|
-
|
226
242
|
## Maintainer
|
227
243
|
|
228
244
|
* Nando Vieira (<http://nandovieira.com.br>)
|
data/lib/qe/sidekiq.rb
CHANGED
@@ -12,12 +12,12 @@ module Qe
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.enqueue(worker, options = {})
|
15
|
-
Worker.sidekiq_options :queue => worker.queue
|
15
|
+
Worker.sidekiq_options worker.options.merge(:queue => worker.queue)
|
16
16
|
Worker.perform_async(worker.name, options)
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.schedule(worker, run_at, options = {})
|
20
|
-
Worker.sidekiq_options :queue => worker.queue
|
20
|
+
Worker.sidekiq_options worker.options.merge(:queue => worker.queue)
|
21
21
|
Worker.perform_at(run_at, worker.name, options)
|
22
22
|
end
|
23
23
|
end
|
data/lib/qe/version.rb
CHANGED
data/spec/qe/sidekiq_spec.rb
CHANGED
@@ -23,7 +23,7 @@ describe Qe::Sidekiq do
|
|
23
23
|
|
24
24
|
context "enqueuing" do
|
25
25
|
let(:worker) {
|
26
|
-
double("worker", :queue => "some_queue", :name => "SomeWorker")
|
26
|
+
double("worker", :queue => "some_queue", :name => "SomeWorker", :options => {})
|
27
27
|
}
|
28
28
|
|
29
29
|
before do
|
@@ -43,11 +43,22 @@ describe Qe::Sidekiq do
|
|
43
43
|
|
44
44
|
Qe::Sidekiq.enqueue(worker, :a => 1)
|
45
45
|
end
|
46
|
+
|
47
|
+
it "sets options" do
|
48
|
+
worker = Class.new do
|
49
|
+
include Qe::Worker
|
50
|
+
options :retry => false
|
51
|
+
end
|
52
|
+
|
53
|
+
expect(Qe::Sidekiq::Worker).to receive(:sidekiq_options)
|
54
|
+
.with(hash_including(:retry => false))
|
55
|
+
Qe::Sidekiq.enqueue(worker)
|
56
|
+
end
|
46
57
|
end
|
47
58
|
|
48
59
|
context "scheduling" do
|
49
60
|
let(:worker) {
|
50
|
-
double("worker", :queue => "some_queue", :name => "SomeWorker")
|
61
|
+
double("worker", :queue => "some_queue", :name => "SomeWorker", :options => {})
|
51
62
|
}
|
52
63
|
|
53
64
|
before do
|
@@ -58,7 +69,7 @@ describe Qe::Sidekiq do
|
|
58
69
|
expect(Qe::Sidekiq::Worker).to receive(:sidekiq_options)
|
59
70
|
.with(:queue => "some_queue")
|
60
71
|
|
61
|
-
Qe::Sidekiq.
|
72
|
+
Qe::Sidekiq.schedule(worker, Time.now)
|
62
73
|
end
|
63
74
|
|
64
75
|
it "schedules job" do
|
@@ -69,5 +80,18 @@ describe Qe::Sidekiq do
|
|
69
80
|
|
70
81
|
Qe::Sidekiq.schedule(worker, date, :a => 1)
|
71
82
|
end
|
83
|
+
|
84
|
+
it "sets options" do
|
85
|
+
Qe.adapter = Qe::Sidekiq
|
86
|
+
|
87
|
+
worker = Class.new do
|
88
|
+
include Qe::Worker
|
89
|
+
options :retry => false
|
90
|
+
end
|
91
|
+
|
92
|
+
expect(Qe::Sidekiq::Worker).to receive(:sidekiq_options)
|
93
|
+
.with(hash_including(:retry => false))
|
94
|
+
Qe::Sidekiq.schedule(worker, Time.now)
|
95
|
+
end
|
72
96
|
end
|
73
97
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -272,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
272
272
|
version: '0'
|
273
273
|
requirements: []
|
274
274
|
rubyforge_project:
|
275
|
-
rubygems_version: 2.
|
275
|
+
rubygems_version: 2.4.5
|
276
276
|
signing_key:
|
277
277
|
specification_version: 4
|
278
278
|
summary: A simple interface over several background job libraries like Resque, Sidekiq
|
@@ -294,4 +294,3 @@ test_files:
|
|
294
294
|
- spec/spec_helper.rb
|
295
295
|
- spec/support/hello_worker.rb
|
296
296
|
- spec/support/localized_worker.rb
|
297
|
-
has_rdoc:
|