sidekiq-uniq 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sidekiq/uniq/middleware.rb +15 -0
- data/lib/sidekiq/uniq/railtie.rb +23 -0
- data/lib/sidekiq/uniq/version.rb +1 -1
- data/sidekiq-uniq-0.1.0.gem +0 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcd844979290e9e9026c43792d00b64efeb01a57
|
4
|
+
data.tar.gz: a63b235c7f9e447b14520c329681a2fee401f7e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57d56ee2f997d7a03e75c01d817b50c0d154fe1c1e7b125cc3ea74d4eff38ee6c5b806b6cc4e569de9cf7219a492ed3299402249b4da303dd34f75f4562701e0
|
7
|
+
data.tar.gz: 8b31a37e790764ad25b480ea76810a8cf01f8e712b2ff47e83288f0250d2ff7797de7feeaae13f15f66de7d388c3dc06afecebf869c843a686e6c75d73858cfe
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Sidekiq
|
2
|
+
module Uniq
|
3
|
+
class Middleware
|
4
|
+
def call(worker_class, msg, queue_name, redis_pool)
|
5
|
+
unless msg['unique'] === false
|
6
|
+
queue = Sidekiq::Queue.new(msg['queue'])
|
7
|
+
queue.each do |job|
|
8
|
+
return false if job.klass == msg['class'] && job.args === msg['args']
|
9
|
+
end
|
10
|
+
end
|
11
|
+
yield
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'sidekiq/uniq/middleware'
|
2
|
+
|
3
|
+
module Sidekiq
|
4
|
+
module Uniq
|
5
|
+
class Railtie < ::Rails::Railtie
|
6
|
+
initializer 'sidekiq_uniq_middleware' do
|
7
|
+
|
8
|
+
Sidekiq.configure_server do |config|
|
9
|
+
config.client_middleware do |chain|
|
10
|
+
chain.add Sidekiq::Uniq::Middleware
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
Sidekiq.configure_client do |config|
|
15
|
+
config.client_middleware do |chain|
|
16
|
+
chain.add Sidekiq::Uniq::Middleware
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/sidekiq/uniq/version.rb
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-uniq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Caio SBA
|
@@ -69,7 +69,10 @@ files:
|
|
69
69
|
- bin/console
|
70
70
|
- bin/setup
|
71
71
|
- lib/sidekiq/uniq.rb
|
72
|
+
- lib/sidekiq/uniq/middleware.rb
|
73
|
+
- lib/sidekiq/uniq/railtie.rb
|
72
74
|
- lib/sidekiq/uniq/version.rb
|
75
|
+
- sidekiq-uniq-0.1.0.gem
|
73
76
|
- sidekiq-uniq.gemspec
|
74
77
|
homepage: https://github.com/caiosba/sidekiq-uniq
|
75
78
|
licenses:
|