mysql_getlock 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: 8625c1078600c6ca873a1f87f635cab49d2e3f49
4
- data.tar.gz: 439b7b5d0d6ba8c4e4adf7920c58cd4a6cd00c33
3
+ metadata.gz: 5a8480ec312241e0c2b54f02aa4de40fe991e148
4
+ data.tar.gz: 6e3311e683eeb0906e43ea1e6bd520c13d01835a
5
5
  SHA512:
6
- metadata.gz: 02e54ae4102c4343d01d7442811b58183ba643b6e7f30dea1fc3051c6abc3f946fdba6e2e991f387da8ad6df1235668b94be8fe7544ada7af17d4bcc174ab8fd
7
- data.tar.gz: 40846197fdf77717614c5e11d1fb84d361f9e3455b8ee69f6a2b6e29564c174ccf339340d4471c8b4faf45f197c108c09a0f3b8a5d5522fa1c053fd0d0552952
6
+ metadata.gz: 2ae6e6631468a268861051a4258959c12e6db7fe16f98eb3f21af023923240804988ef762ba955e3889c719a3bd3ece47c108ce87f8ae061c7682f57dc39a70e
7
+ data.tar.gz: 8c40374163c91c2ca1f93d57018b99c6bf58388f16b353e65f4594c04eced43d14c3166d98411f56a135ba30059e339de6318e954816cf2439ad2c1e1f2efa22
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.1.2 (2016-08-28)
2
+
3
+ Enhancements:
4
+
5
+ * #lock returns true if it successfully acquired a lock
6
+
1
7
  # 0.1.1 (2016-08-28)
2
8
 
3
9
  Fixes:
data/README.md CHANGED
@@ -48,13 +48,13 @@ Or install it yourself as:
48
48
  Similarly with ruby standard library [mutex](https://ruby-doc.org/core-2.2.0/Mutex.html), following methods are available:
49
49
 
50
50
  * lock
51
- * Attempts to grab the lock and waits if it isn’t available.
51
+ * Attempts to grab the lock and waits if it isn’t availabl. Returns true if successfully acquird a lock.
52
52
  * locked?
53
53
  * Returns true if this lock is currently held by some.
54
54
  * synchronize {}
55
55
  * Obtains a lock, runs the block, and releases the lock when the block completes.
56
56
  * unlock
57
- * Releases the lock.
57
+ * Releases the lock. Returns true if successfully released a lock.
58
58
 
59
59
  Options of `MysqlGetlock.new` are:
60
60
 
@@ -1,3 +1,3 @@
1
1
  class MysqlGetlock
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/mysql_getlock.rb CHANGED
@@ -33,12 +33,15 @@ class MysqlGetlock
33
33
  when 1
34
34
  logger.info { "#{log_head}Acquired a mysql lock '#{key}'" } if logger
35
35
  set_current_session_key(key)
36
+ true
36
37
  when 0
37
38
  logger.info { "#{log_head}Timeout to acquire a mysql lock '#{key}'" } if logger
38
39
  release_current_session_key
40
+ false
39
41
  else # nil
40
42
  logger.info { "#{log_head}Unknown Error to acquire a mysql lock '#{key}'" } if logger
41
43
  release_current_session_key
44
+ false
42
45
  end
43
46
  end
44
47
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mysql_getlock
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
  - Naotoshi Seo