sidekiq-debouncer 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +9 -0
- data/lib/sidekiq/debouncer/middleware/client.rb +9 -3
- data/lib/sidekiq/debouncer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bab3413954e727ee13bc4d216f13621d1337df24f1ed970ecf146fae30501ef6
|
4
|
+
data.tar.gz: 883a815a2bb23e08abb175bf04f0231e028684d174c3d60bef6cc1450294764d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 254b6d10c2cf611d91e6971f9e21cc76964600ab951f718c88aa0d7eacb38fe3fccc4bd4f0e0f971d33e829e5a6ce0997d5c1a7a9886bc95e503a554b57e0241
|
7
|
+
data.tar.gz: 8d5877eec61fb2dbac4305db1815afc320306e0c1af78a872468a5a2218dd48f4b9f8a954e323e59aa3d088b783ae61cc14140a987c3f0785c80a3621c0dcbf7
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -103,6 +103,15 @@ end
|
|
103
103
|
|
104
104
|
In order to test the behavior of `sidekiq-debouncer` it is necessary to disable testing mode. It is the limitation of internal implementation.
|
105
105
|
|
106
|
+
Sidekiq::Debouncer will not debounce the jobs in testing mode, instead they'll be executed like normal jobs (pushed to fake queue or executed inline depending on settings).
|
107
|
+
Server middleware needs to be added to `Sidekiq::Testing` chain:
|
108
|
+
|
109
|
+
```ruby
|
110
|
+
Sidekiq::Testing.server_middleware do |chain|
|
111
|
+
chain.add Sidekiq::Debouncer::Middleware::Server
|
112
|
+
end
|
113
|
+
```
|
114
|
+
|
106
115
|
## License
|
107
116
|
|
108
117
|
MIT Licensed. See LICENSE.txt for details.
|
@@ -28,9 +28,6 @@ module Sidekiq
|
|
28
28
|
return job if !klass.get_sidekiq_options["debounce"] || job["debounce_key"]
|
29
29
|
|
30
30
|
debounce(klass, job)
|
31
|
-
|
32
|
-
# prevent normal sidekiq flow
|
33
|
-
false
|
34
31
|
end
|
35
32
|
|
36
33
|
private
|
@@ -46,9 +43,14 @@ module Sidekiq
|
|
46
43
|
job["args"] = [job["args"]]
|
47
44
|
job.delete("debounce")
|
48
45
|
|
46
|
+
return job if testing?
|
47
|
+
|
49
48
|
redis do |connection|
|
50
49
|
redis_debounce(connection, keys: ["schedule", key], argv: [Sidekiq.dump_json(job), time, @debounce_key_ttl])
|
51
50
|
end
|
51
|
+
|
52
|
+
# prevent normal sidekiq flow
|
53
|
+
false
|
52
54
|
end
|
53
55
|
|
54
56
|
def debounce_key(klass, job, options)
|
@@ -79,6 +81,10 @@ module Sidekiq
|
|
79
81
|
retry
|
80
82
|
end
|
81
83
|
end
|
84
|
+
|
85
|
+
def testing?
|
86
|
+
defined?(Sidekiq::Testing) && Sidekiq::Testing.enabled?
|
87
|
+
end
|
82
88
|
end
|
83
89
|
end
|
84
90
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-debouncer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Zuchmański
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-03-
|
12
|
+
date: 2023-03-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sidekiq
|