pg_advisory_locker 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -55,11 +55,13 @@ module PgAdvisoryLocker
|
|
55
55
|
locked = uncached do
|
56
56
|
find_by_sql(["select pg_try_advisory_lock(?, ?)", table_oid, id])[0].pg_try_advisory_lock == "t"
|
57
57
|
end
|
58
|
-
if
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
58
|
+
if locked
|
59
|
+
if block.present?
|
60
|
+
begin
|
61
|
+
block.call
|
62
|
+
ensure
|
63
|
+
unlock_record(id)
|
64
|
+
end
|
63
65
|
end
|
64
66
|
end
|
65
67
|
return locked
|
data/pg_advisory_locker.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.name = 'pg_advisory_locker'
|
8
8
|
s.version = PgAdvisoryLocker::VERSION
|
9
9
|
s.license = 'New BSD License'
|
10
|
-
s.date = '2012-
|
10
|
+
s.date = '2012-10-02'
|
11
11
|
s.summary = "Helper for calling PostgreSQL pg_advisory_lock, pg_advisory_try_lock, and pg_advisory_unlock."
|
12
12
|
s.description = "This gem provides a module that, when included in your ActiveRecord model, provides methods to acquire and release advisory locks for PostgreSQL connections."
|
13
13
|
s.authors = ["Keith Gabryelski"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_advisory_locker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pg
|