ruby_redis_lock 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
  SHA256:
3
- metadata.gz: e55f4562edfe070bce4409e5ac5f80599b44d1b02fad75ca5beeab86afcfb43a
4
- data.tar.gz: 37730f073baa006452b6c47141cecc1171f241e150957408fa9fad769f180a0d
3
+ metadata.gz: ae918c26080b69209659bbc248f2234f2e55603632a2c8b6df87402ac4e2fd99
4
+ data.tar.gz: 0f65ad9c58b73171282acc74a0ec40421966c13c0e1f931a70c1252dc09092c1
5
5
  SHA512:
6
- metadata.gz: 8324228d9255e2720a994930ca6670706f58f2bf74b827651e49a4d121df757df9b0b782df8b997b8cebcb5a4bd52e04c45097c11ef154e36161658a1fa4adce
7
- data.tar.gz: '0792e704125408ffbc7b11a21b71865e27b620b5653ea78d5e67d10dd0a737259125191fbbd4d398481a292c597a2f44cf1832da48a513aa11ef35a7e2d51109'
6
+ metadata.gz: a34b090b3e8648952bf5a664b56c2f2f951fc1f03cbedce5f3debdf21523f3f083cb1cc44c860a71ece2c619b2934fdf417dd9830933950e8f886fc13ac3e311
7
+ data.tar.gz: 0f211c70aff7af587aa2bcb076b86555f7b0cb8c457d2eb9ac609cc8bfce664d384d93eea5928c328d12bc582d1c123cf2ffa399309f0f0172308da0a7e0ee07
@@ -1,5 +1,6 @@
1
1
  module RubyRedisLock
2
2
 
3
+ LOCK_KEY_BASE = "RubyRedisLock".freeze
3
4
  LockAcquisitionTimeoutException = Class.new(StandardError)
4
5
 
5
6
  def lock(lock_name, processing_timeout=60, acquiring_timout=10)
@@ -24,7 +25,7 @@ module RubyRedisLock
24
25
 
25
26
  def try_acquire_lock(lock_name, processing_timeout=60)
26
27
  ret = self.setnx(ruby_redis_lock_key(lock_name), "#{Time.now.to_i + processing_timeout}")
27
- return true if ret == true
28
+ return true if ret
28
29
 
29
30
  expiration = self.get(ruby_redis_lock_key(lock_name)).to_i
30
31
  return false if Time.now.to_i < expiration
@@ -50,7 +51,7 @@ module RubyRedisLock
50
51
  end
51
52
 
52
53
  def ruby_redis_lock_key(lock_name)
53
- "RubyRedisLock:#{lock_name}"
54
+ "#{LOCK_KEY_BASE}:#{lock_name}"
54
55
  end
55
56
 
56
57
  end
@@ -1,3 +1,3 @@
1
1
  module RubyRedisLock
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: ruby_redis_lock
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
  - Tanin Na Nakorn
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-05-07 00:00:00.000000000 Z
12
+ date: 2018-08-15 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: distributed lock for Ruby (using Redis)
15
15
  email: