debounce 0.1.1 → 0.1.2

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
  SHA1:
3
- metadata.gz: 5350f78336266c925f85c22707e682a49fbed41b
4
- data.tar.gz: 71049418e296d4a64b59f00e884dcf32db84885d
3
+ metadata.gz: 96c6a78a36d7b65bf4320546f4c26821c413f66a
4
+ data.tar.gz: 1f68e7cfced478fed799254ee86443890d959d47
5
5
  SHA512:
6
- metadata.gz: e94b1da6eb04fd38b3055f21915817a7fc3fedf0cf282e6d9029d434fe0906461401e9d88c70e550ce675687ebdddb59b441de26ebad714769c6c9aa672173dd
7
- data.tar.gz: 4cc76a7792d1d116307444a56234e348281148dce7dd9a2c7a67c4a89a069da8637abdd7ff16bdbe72666b3f36c9255b2e33abcf48a07e51dbf68963ad842a35
6
+ metadata.gz: 32af41082f5a9f7c64225e921cac58795e08eb5aa7d7e13c38967485bb1a9bc50a1697a27cfad1cad2e99b4a1a122c11047c769d5007fb4e58e9c28a684a7885
7
+ data.tar.gz: 1eb8062340b7c6be48fe0b90782b9cb7ce9c0e5846f2797869b929f465b0b1b8e8e911891ef9658bfd34891d7615cc73197c2ca6612bf5c8022f3d8be2343857
@@ -17,12 +17,12 @@ module Debounce
17
17
  end
18
18
  end
19
19
 
20
- def self.call(key, timeout: 1)
20
+ def self.call(key, timeout: 1, stale_client_timeout: 600) # 10 minutes
21
21
  lock_key = "DEBOUNCE:#{key}"
22
- semaphore1 = Redis::Semaphore.new("#{lock_key}-1", resources: 2, redis: redis.dup)
22
+ semaphore1 = Redis::Semaphore.new("#{lock_key}-1", resources: 2, stale_client_timeout: stale_client_timeout, redis: redis.dup)
23
23
  semaphore1.lock(timeout) do
24
- semaphore2 = Redis::Semaphore.new("#{lock_key}-2", resources: 1, redis: redis.dup)
25
24
  start = Time.now
25
+ semaphore2 = Redis::Semaphore.new("#{lock_key}-2", resources: 1, stale_client_timeout: stale_client_timeout, redis: redis.dup)
26
26
  semaphore2.lock do
27
27
  yield
28
28
  end
@@ -1,4 +1,3 @@
1
- require 'connection_pool'
2
1
  require 'redis'
3
2
  require 'uri'
4
3
 
@@ -1,3 +1,3 @@
1
1
  module Debounce
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debounce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephan Kaag