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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c79e5e05584c2d05e9272eb43e785609398fef9
4
- data.tar.gz: 1ae6d25d095f28b2d834e173fc805c7018ad414f
3
+ metadata.gz: fcd844979290e9e9026c43792d00b64efeb01a57
4
+ data.tar.gz: a63b235c7f9e447b14520c329681a2fee401f7e0
5
5
  SHA512:
6
- metadata.gz: 5e7275c81e0b0574fcf6fdb4bd86a3e34a638be8e0b9059ff5b9ee8e8c51db859395f27e958f9fb3a54a82cd6246e0d14c5d34dd131736f35d204ac740141291
7
- data.tar.gz: 8662763010df691baeb5cbb877cfcfb34af843511dcadf885652be2bd9923d1f4bb7e8cea9343797a59e5f00865bceeae123af30b3d804f3a3b32c481aa1e690
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
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Uniq
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
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.1.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: