sidekiq-middleware 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES.md +5 -0
- data/lib/sidekiq-middleware/client/unique_jobs.rb +2 -0
- data/lib/sidekiq-middleware/version.rb +1 -1
- data/sidekiq-middleware.gemspec +3 -2
- data/test/test_unique_jobs.rb +10 -6
- metadata +27 -27
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f349d0be192e15acd3e7583662a4011e858b80f1
|
4
|
+
data.tar.gz: 70041e4a2eb69940fa1ae24fa89339d06d13b733
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 77faf9f4982d9cd4c7334ed3368e356192fec79e893c82e643a4597230ebf91dbc7f028321d0d7c3a6120e8cd317b2c8808431d277a89c63ab6c6ea454ef386a
|
7
|
+
data.tar.gz: f660c82eaddfad7ba5b6ecaedc94700e63cfcd4a0d784a4a37bce265c3ebfbdafa62b8b55e6a58a64d20f68837830459ec7e7c2a72d94db365b8134efbbec140
|
data/CHANGES.md
CHANGED
@@ -5,6 +5,8 @@ module Sidekiq
|
|
5
5
|
HASH_KEY_EXPIRATION = 30 * 60
|
6
6
|
|
7
7
|
def call(worker_class, item, queue)
|
8
|
+
worker_class = worker_class.constantize if worker_class.is_a?(String)
|
9
|
+
|
8
10
|
enabled, expiration = worker_class.get_sidekiq_options['unique'],
|
9
11
|
(worker_class.get_sidekiq_options['expiration'] || HASH_KEY_EXPIRATION)
|
10
12
|
|
data/sidekiq-middleware.gemspec
CHANGED
@@ -13,8 +13,9 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.name = "sidekiq-middleware"
|
14
14
|
gem.require_paths = ["lib"]
|
15
15
|
gem.version = Sidekiq::Middleware::VERSION
|
16
|
-
|
17
|
-
gem.add_dependency 'sidekiq'
|
16
|
+
|
17
|
+
gem.add_dependency 'sidekiq', '~> 2.12.4'
|
18
18
|
gem.add_development_dependency 'rake'
|
19
|
+
gem.add_development_dependency 'bundler', '~> 1.0'
|
19
20
|
gem.add_development_dependency 'minitest', '~> 3'
|
20
21
|
end
|
data/test/test_unique_jobs.rb
CHANGED
@@ -77,15 +77,16 @@ class TestUniqueJobs < MiniTest::Unit::TestCase
|
|
77
77
|
# Schedule
|
78
78
|
5.times { |t| UniqueScheduledWorker.perform_in((t+1)*60, 'args') }
|
79
79
|
assert_equal 1, Sidekiq.redis { |c| c.zcard('schedule') }
|
80
|
-
|
80
|
+
|
81
81
|
# Process
|
82
82
|
msg = Sidekiq.dump_json('class' => UniqueScheduledWorker.to_s, 'queue' => 'unique_scheduled_queue', 'args' => ['args'])
|
83
83
|
actor = MiniTest::Mock.new
|
84
84
|
actor.expect(:processor_done, nil, [@processor])
|
85
|
-
|
85
|
+
actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
|
86
|
+
2.times { @boss.expect(:async, actor, []) }
|
86
87
|
work = UnitOfWork.new('default', msg)
|
87
88
|
@processor.process(work)
|
88
|
-
|
89
|
+
|
89
90
|
# Re-schedule
|
90
91
|
5.times { |t| UniqueScheduledWorker.perform_in((t+1)*60, 'args') }
|
91
92
|
assert_equal 2, Sidekiq.redis { |c| c.zcard('schedule') }
|
@@ -121,7 +122,8 @@ class TestUniqueJobs < MiniTest::Unit::TestCase
|
|
121
122
|
msg = Sidekiq.dump_json('class' => CustomUniqueWorker.to_s, 'args' => ['something', false])
|
122
123
|
actor = MiniTest::Mock.new
|
123
124
|
actor.expect(:processor_done, nil, [@processor])
|
124
|
-
|
125
|
+
actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
|
126
|
+
2.times { @boss.expect(:async, actor, []) }
|
125
127
|
work = UnitOfWork.new('default', msg)
|
126
128
|
@processor.process(work)
|
127
129
|
}
|
@@ -133,7 +135,8 @@ class TestUniqueJobs < MiniTest::Unit::TestCase
|
|
133
135
|
msg = Sidekiq.dump_json('class' => CustomUniqueWorker.to_s, 'args' => ['something', false], 'sent_at' => (Time.now + i*60).to_f)
|
134
136
|
actor = MiniTest::Mock.new
|
135
137
|
actor.expect(:processor_done, nil, [@processor])
|
136
|
-
|
138
|
+
actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
|
139
|
+
2.times { @boss.expect(:async, actor, []) }
|
137
140
|
work = UnitOfWork.new('default', msg)
|
138
141
|
@processor.process(work)
|
139
142
|
}
|
@@ -145,7 +148,8 @@ class TestUniqueJobs < MiniTest::Unit::TestCase
|
|
145
148
|
msg = Sidekiq.dump_json('class' => CustomUniqueWorker.to_s, 'args' => ['something', true])
|
146
149
|
actor = MiniTest::Mock.new
|
147
150
|
actor.expect(:processor_done, nil, [@processor])
|
148
|
-
|
151
|
+
actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
|
152
|
+
2.times { @boss.expect(:async, actor, []) }
|
149
153
|
work = UnitOfWork.new('default', msg)
|
150
154
|
@processor.process(work)
|
151
155
|
}
|
metadata
CHANGED
@@ -1,52 +1,60 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-middleware
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Dmitry Krasnoukhov
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-06-22 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: sidekiq
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
19
|
+
version: 2.12.4
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
26
|
+
version: 2.12.4
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
46
55
|
- !ruby/object:Gem::Dependency
|
47
56
|
name: minitest
|
48
57
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
58
|
requirements:
|
51
59
|
- - ~>
|
52
60
|
- !ruby/object:Gem::Version
|
@@ -54,7 +62,6 @@ dependencies:
|
|
54
62
|
type: :development
|
55
63
|
prerelease: false
|
56
64
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
65
|
requirements:
|
59
66
|
- - ~>
|
60
67
|
- !ruby/object:Gem::Version
|
@@ -86,33 +93,26 @@ files:
|
|
86
93
|
- test/test_unique_jobs.rb
|
87
94
|
homepage: http://github.com/krasnoukhov/sidekiq-middleware
|
88
95
|
licenses: []
|
96
|
+
metadata: {}
|
89
97
|
post_install_message:
|
90
98
|
rdoc_options: []
|
91
99
|
require_paths:
|
92
100
|
- lib
|
93
101
|
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
-
none: false
|
95
102
|
requirements:
|
96
|
-
- -
|
103
|
+
- - '>='
|
97
104
|
- !ruby/object:Gem::Version
|
98
105
|
version: '0'
|
99
|
-
segments:
|
100
|
-
- 0
|
101
|
-
hash: -2342858666365224012
|
102
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
-
none: false
|
104
107
|
requirements:
|
105
|
-
- -
|
108
|
+
- - '>='
|
106
109
|
- !ruby/object:Gem::Version
|
107
110
|
version: '0'
|
108
|
-
segments:
|
109
|
-
- 0
|
110
|
-
hash: -2342858666365224012
|
111
111
|
requirements: []
|
112
112
|
rubyforge_project:
|
113
|
-
rubygems_version:
|
113
|
+
rubygems_version: 2.0.3
|
114
114
|
signing_key:
|
115
|
-
specification_version:
|
115
|
+
specification_version: 4
|
116
116
|
summary: Additional sidekiq middleware
|
117
117
|
test_files:
|
118
118
|
- test/helper.rb
|