sidekiq-uniq 0.4.0 → 0.5.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 +2 -4
- data/lib/sidekiq/uniq/railtie.rb +5 -7
- data/lib/sidekiq/uniq/status.rb +2 -2
- data/lib/sidekiq/uniq/version.rb +1 -1
- data/sidekiq-uniq-0.4.0.gem +0 -0
- metadata +2 -3
- data/sidekiq-uniq-0.1.0.gem +0 -0
- data/sidekiq-uniq-0.2.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b2b32221e78a36897f8403fb309ef2b82e43f9a
|
4
|
+
data.tar.gz: 9e6ea3a7759fd3a5211efb04ce2135a11d949db8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12b732895efd8b1f4d0712efab9fa808eede82f7fc5d2b7d0d36a5c7623c4f7c57a91c0b76b98ec455be492d0bd8ce6f5fd57f694fea30c73a93adb90937bcc2
|
7
|
+
data.tar.gz: 26afda27a80958c1e2bc3168b4ba3c3471adeff2a6a12f932ec3d17c5eba42441bfc02ea91988b1992e61b74cf65d5f0b65f5d288a70ac4a2d3027e3425edaf8
|
@@ -8,13 +8,11 @@ module Sidekiq
|
|
8
8
|
# Runs before job is added to queue
|
9
9
|
|
10
10
|
def call(worker_class, msg, queue_name, redis_pool)
|
11
|
-
|
12
|
-
yield
|
13
|
-
else
|
11
|
+
unless msg['unique'] === false
|
14
12
|
return false if Status.running_or_enqueued(msg, redis_pool)
|
15
13
|
Status.save_status(msg, :enqueued, redis_pool)
|
16
|
-
yield
|
17
14
|
end
|
15
|
+
yield
|
18
16
|
end
|
19
17
|
end
|
20
18
|
|
data/lib/sidekiq/uniq/railtie.rb
CHANGED
@@ -4,19 +4,17 @@ module Sidekiq
|
|
4
4
|
module Uniq
|
5
5
|
class Railtie < ::Rails::Railtie
|
6
6
|
initializer 'sidekiq_uniq_middleware' do
|
7
|
-
|
8
7
|
Sidekiq.configure_server do |config|
|
9
|
-
config.client_middleware do |chain|
|
10
|
-
chain.add Sidekiq::Uniq::ServerMiddleware
|
11
|
-
end
|
12
|
-
end
|
13
8
|
|
14
|
-
Sidekiq.configure_client do |config|
|
15
9
|
config.client_middleware do |chain|
|
16
10
|
chain.add Sidekiq::Uniq::ClientMiddleware
|
17
11
|
end
|
18
|
-
end
|
19
12
|
|
13
|
+
config.server_middleware do |chain|
|
14
|
+
chain.add Sidekiq::Uniq::ServerMiddleware
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
20
18
|
end
|
21
19
|
end
|
22
20
|
end
|
data/lib/sidekiq/uniq/status.rb
CHANGED
@@ -12,7 +12,7 @@ module Sidekiq
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.key(msg)
|
15
|
-
KEY + ':' + Digest::MD5.hexdigest(msg[
|
15
|
+
KEY + ':' + Digest::MD5.hexdigest(msg['class'].to_s + ':' + msg['args'].inspect)
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.save_status(msg, status, redis = nil)
|
@@ -30,7 +30,7 @@ module Sidekiq
|
|
30
30
|
Status.redis(redis) do |conn|
|
31
31
|
status = conn.get(Status.key(msg)).to_s
|
32
32
|
end
|
33
|
-
status === 'running' || status === 'enqueued'
|
33
|
+
(status === 'running' || status === 'enqueued')
|
34
34
|
end
|
35
35
|
|
36
36
|
def self.clear(redis = nil)
|
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.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Caio SBA
|
@@ -73,8 +73,7 @@ files:
|
|
73
73
|
- lib/sidekiq/uniq/railtie.rb
|
74
74
|
- lib/sidekiq/uniq/status.rb
|
75
75
|
- lib/sidekiq/uniq/version.rb
|
76
|
-
- sidekiq-uniq-0.
|
77
|
-
- sidekiq-uniq-0.2.0.gem
|
76
|
+
- sidekiq-uniq-0.4.0.gem
|
78
77
|
- sidekiq-uniq.gemspec
|
79
78
|
homepage: https://github.com/caiosba/sidekiq-uniq
|
80
79
|
licenses:
|
data/sidekiq-uniq-0.1.0.gem
DELETED
Binary file
|
data/sidekiq-uniq-0.2.0.gem
DELETED
Binary file
|