istox 0.2.14.2 → 0.2.14.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0bce8aeff0172a935744cd551d7484db72b031c6d5c1987e333556ca78371472
4
- data.tar.gz: c64f7d731ad1295b6713225e347484c20cc52e240f33c096a5b2196f4ab3f1e0
3
+ metadata.gz: 191d8ea6fdad58b0fe99961ac461eaaab8d80e684172b11632d056e27f9b6c92
4
+ data.tar.gz: c69b2ef4fbd2ee80619690ba61cd434f6f527f95ea2cb3c9dd44e35cc997200e
5
5
  SHA512:
6
- metadata.gz: 0aff2668703907f10658e8d083224e26a15b01871aa73f7118b4405475b96d1442b8c451fa0261a173cc8b42c06c60af939fb2be60b91811e8a36818de53f19b
7
- data.tar.gz: c5bef66c72b43dcd00f9c536a6bc8e186c1d9f657ec749346638ccc624b1762c08a1a5f9173ba609b426187353c8af40784ebfad09aee849dc1a33fe3c1efb11
6
+ metadata.gz: f3c49ba90cb39a0773de6bc7781d08c66e1db7356d214c2c971fd0dae7b4d0daa92c5e9fda2426df67cd2a8ffa13816d263946aab46ca564833ff6cc6e220b36
7
+ data.tar.gz: 78f888d34684fc979354b8bc13b781f0f9aee530c2ffa0f46285298f460dda6a96c235a47856b25e711cf853df5208a0e98e02b3e3d4c3080d14219697d84038
@@ -22,6 +22,16 @@ module Istox
22
22
  log.info("Releasing lock for key: #{key}")
23
23
  end
24
24
 
25
+ ### lock with block
26
+ def lock!(key, expired_seconds: 20)
27
+ acquire!(key, expired_seconds: expired_seconds)
28
+ yield
29
+ release(key)
30
+ rescue StandardError => e
31
+ release(key)
32
+ raise e
33
+ end
34
+
25
35
  def request_redis
26
36
  @request_redis ||= ::Istox::RedisManager.request_redis
27
37
  end
data/lib/istox/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Istox
2
- VERSION = '0.2.14.2'.freeze
2
+ VERSION = '0.2.14.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: istox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.14.2
4
+ version: 0.2.14.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siong Leng