with_advisory_lock 3.1.1 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/with_advisory_lock/postgresql.rb +2 -1
- data/lib/with_advisory_lock/version.rb +1 -1
- data/test/lock_test.rb +8 -0
- data/with_advisory_lock.gemspec +0 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e94aa36a41376cf160850770d5a49a3d301aea4e
|
4
|
+
data.tar.gz: 1e7ac3e6f61566a8e2fd1da766c762405f8a7502
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 002a011573e173b6957fc7b51023274ed7f34032f2502def7b6b1c9219aa34979552fda5a615816d3b4be246c083a7d9a8d1e71e9bb324a88183ae4a354bdc36
|
7
|
+
data.tar.gz: f30b67b87759cf3c085b96e995e9788728c956b1f74f585d5a198100840d65bc427d6844df99420bacf17d3c4dfbc8b108c77cf4b0ca8bc54a03aec1214991b5
|
data/README.md
CHANGED
@@ -158,6 +158,12 @@ end
|
|
158
158
|
|
159
159
|
## Changelog
|
160
160
|
|
161
|
+
### 3.2.0
|
162
|
+
|
163
|
+
* [Joshua Flanagan](https://github.com/joshuaflanagan) [added a SQL comment to the lock query for PostgreSQL](https://github.com/ClosureTree/with_advisory_lock/pull/28). Thanks!
|
164
|
+
|
165
|
+
* [Fernando Luizão](https://github.com/fernandoluizao) found a spurious requirement for `thread_safe`. Thanks for the [fix](https://github.com/ClosureTree/with_advisory_lock/pull/27)!
|
166
|
+
|
161
167
|
### 3.1.1
|
162
168
|
|
163
169
|
* [Joel Turkel](https://github.com/jturkel) added `require 'active_support'` (it was required, but relied on downstream gems to pull in active_support before pulling in with_advisory_lock). Thanks!
|
@@ -21,7 +21,8 @@ module WithAdvisoryLock
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def execute_successful?(pg_function)
|
24
|
-
|
24
|
+
comment = lock_name.gsub(/(\/\*)|(\*\/)/, "--")
|
25
|
+
sql = "SELECT #{pg_function}(#{lock_keys.join(',')}) AS #{unique_column_name} /* #{comment} */"
|
25
26
|
result = connection.select_value(sql)
|
26
27
|
# MRI returns 't', jruby returns true. YAY!
|
27
28
|
(result == 't' || result == true)
|
data/test/lock_test.rb
CHANGED
@@ -14,6 +14,14 @@ describe 'class methods' do
|
|
14
14
|
Tag.current_advisory_lock.must_match(/#{lock_name}/)
|
15
15
|
end
|
16
16
|
end
|
17
|
+
|
18
|
+
it 'can obtain a lock with a name that attempts to disrupt a SQL comment' do
|
19
|
+
dangerous_lock_name = 'test */ lock /*'
|
20
|
+
Tag.with_advisory_lock(dangerous_lock_name) do
|
21
|
+
Tag.current_advisory_lock.must_match(/#{Regexp.escape(dangerous_lock_name)}/)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
17
25
|
end
|
18
26
|
|
19
27
|
describe '.advisory_lock_exists?' do
|
data/with_advisory_lock.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: with_advisory_lock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew McEachen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.2'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: thread_safe
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: yard
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|