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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +2 -2
- data/lib/mysql_getlock/version.rb +1 -1
- data/lib/mysql_getlock.rb +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a8480ec312241e0c2b54f02aa4de40fe991e148
|
4
|
+
data.tar.gz: 6e3311e683eeb0906e43ea1e6bd520c13d01835a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ae6e6631468a268861051a4258959c12e6db7fe16f98eb3f21af023923240804988ef762ba955e3889c719a3bd3ece47c108ce87f8ae061c7682f57dc39a70e
|
7
|
+
data.tar.gz: 8c40374163c91c2ca1f93d57018b99c6bf58388f16b353e65f4594c04eced43d14c3166d98411f56a135ba30059e339de6318e954816cf2439ad2c1e1f2efa22
|
data/CHANGELOG.md
CHANGED
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
|
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
|
|
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
|
|