sidekiq-debouncer 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 939e5397d600c7f5f24b3757f46f0c613369079ef327c8e88bf5adcdf807733f
4
- data.tar.gz: 6ee4f636b9297a232a82bcf6c27c1418408cd2ad66ad8e473945fd1fdbc12cb0
3
+ metadata.gz: 78b258ab5ad21facbcf96f6aab96f30e38542ea24a7c5fd9e23ee99057b67e6d
4
+ data.tar.gz: 19db1ba7e392a4de9dcedfa8e236b8e8e334d7de56e71d8241aeb4e2d20b5e0a
5
5
  SHA512:
6
- metadata.gz: 3b84978f7ea580d81a052719860ef38fc10339d35064c768457ffcccf0effb7dd148a2bd7a6620489a68c5a03705aea400f2ce8f493e2d0e27fa48edcb806082
7
- data.tar.gz: f0e2d36120e11883f9b2f29b4de2f4fcbfbae075c72592742b9b6a3f323458a0bf7222fb4853604df45c1755e15ead8b600024630bd976631d3df4b5679f996a
6
+ metadata.gz: 4c30876a9db412ee65a844c966fec6b4f2c84e33f5eb0393773c7db0ad9fd5d6c394b4c9a2f01e31178c93dcc5d5443e829e03f90a9c1db81814f594153af290
7
+ data.tar.gz: 44e2d19a313ca3d07daaed130a9fb8a21721a6e6ed17756ed21028017096dd528d6b6a2d482a624095822c23158a9777620ae6dbeb0e541b8e2c7acebd003f68
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## [2.0.1] - 2023-03-04
2
+ - don't remove debounce key in redis to avoid invalid debouncing
3
+
1
4
  ## [2.0.0] - 2023-02-28
2
5
  Complete rewrite of the library:
3
6
  - Instead of iterating through whole schedule set, sidekiq-debouncer will now cache debounce key in redis with a reference to the job.
data/README.md CHANGED
@@ -88,8 +88,8 @@ Keep in mind that the result of the debounce method will be converted to string,
88
88
 
89
89
  In the application, call `MyWorker.perform_async(...)` as usual. Everytime you call this function, `MyWorker`'s execution will be postponed by 5 minutes. After that time `MyWorker` will receive a method call `perform` with an array of arguments that were provided to the `MyWorker.perform_async(...)` calls.
90
90
 
91
- To avoid keeping leftover keys in redis (for example, when job was manually removed from schedule set), all additional keys are created with TTL.
92
- It's 7 days by default and should be ok in most of the cases. If you are debouncing your jobs in higher interval than that, you can overwrite this setting:
91
+ To avoid keeping leftover keys in redis, all additional keys are created with TTL.
92
+ It's 24 hours by default and should be ok in most of the cases. If you are debouncing your jobs in higher interval than that, you can overwrite this setting:
93
93
 
94
94
  ```ruby
95
95
  Sidekiq.configure_client do |config|
@@ -17,7 +17,7 @@ module Sidekiq
17
17
  REDIS_ERROR_CLASS = defined?(RedisClient::CommandError) ? RedisClient::CommandError : Redis::CommandError
18
18
 
19
19
  def initialize(options = {})
20
- @debounce_key_ttl = options.fetch(:ttl, 60 * 60 * 24 * 7) # 7 days by default
20
+ @debounce_key_ttl = options.fetch(:ttl, 60 * 60 * 24) # 24 hours by default
21
21
  end
22
22
 
23
23
  def call(worker_class, job, _queue, _redis_pool)
@@ -3,20 +3,13 @@
3
3
  module Sidekiq
4
4
  module Debouncer
5
5
  module Middleware
6
- # Server middleware removes debounce key from redis before executing the job
6
+ # wrap args into array because sidekiq uses splat while calling perform
7
7
  class Server
8
8
  include Sidekiq::ServerMiddleware
9
9
 
10
10
  def call(_worker, job, _queue)
11
11
  if job.key?("debounce_key")
12
- # skip if job comes from dead or retry set
13
- unless job.key?("failed_at")
14
- redis do |connection|
15
- connection.call("DEL", job["debounce_key"])
16
- end
17
- end
18
-
19
- job["args"] = [job["args"]] # wrap args into array because sidekiq uses splat while calling perform
12
+ job["args"] = [job["args"]]
20
13
  end
21
14
 
22
15
  yield
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sidekiq
4
4
  module Debouncer
5
- VERSION = "2.0.0"
5
+ VERSION = "2.0.1"
6
6
  end
7
7
  end
@@ -12,6 +12,7 @@ Gem::Specification.new do |gem|
12
12
  gem.email = ["sebcioz@gmail.com", "kukicola@gmail.com"]
13
13
  gem.summary = "Sidekiq extension that adds the ability to debounce job execution"
14
14
  gem.description = <<~DESCRIPTION
15
+ Sidekiq extension that adds the ability to debounce job execution.
15
16
  Worker will postpone its execution after `wait time` have elapsed since the last time it was invoked.
16
17
  Useful for implementing behavior that should only happen after the input has stopped arriving.
17
18
  DESCRIPTION
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.0
4
+ version: 2.0.1
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-02-28 00:00:00.000000000 Z
12
+ date: 2023-03-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sidekiq
@@ -102,6 +102,7 @@ dependencies:
102
102
  - !ruby/object:Gem::Version
103
103
  version: 1.24.3
104
104
  description: |
105
+ Sidekiq extension that adds the ability to debounce job execution.
105
106
  Worker will postpone its execution after `wait time` have elapsed since the last time it was invoked.
106
107
  Useful for implementing behavior that should only happen after the input has stopped arriving.
107
108
  email: