pg_lock 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/pg_lock.rb +9 -3
- data/lib/pg_lock/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4751ff801966253cdbd7662bf288c44251b0c50
|
4
|
+
data.tar.gz: a826d5ee152d541b70dbd1a448cfabd005f6e100
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44720df9698d51ec531713d26faa8379df673b408b686892413af5122f32d8f1b7517561354bcacbc9ba0e323e4aa6b2a875cf49340f4d877b057757b14ee43e
|
7
|
+
data.tar.gz: 073c50e4bd05804b57cc22d019b4ca5def74c21032e52d9a31d9fcff20ca49da3fc72e0098c1292fdde2f20b6eef6638a91dd634c0accc9013015cc5e6484af7
|
data/CHANGELOG.md
CHANGED
data/lib/pg_lock.rb
CHANGED
@@ -5,8 +5,14 @@ require "pg_lock/version"
|
|
5
5
|
|
6
6
|
class PgLock
|
7
7
|
PG_LOCK_SPACE = -2147483648
|
8
|
-
|
9
|
-
defined?(
|
8
|
+
DEFAULT_CONNECTION_CONNECTOR = Proc.new do
|
9
|
+
if defined?(DEFAULT_CONNECTION)
|
10
|
+
DEFAULT_CONNECTION
|
11
|
+
elsif defined?(ActiveRecord::Base)
|
12
|
+
ActiveRecord::Base.connection.raw_connection
|
13
|
+
else
|
14
|
+
false
|
15
|
+
end
|
10
16
|
end
|
11
17
|
|
12
18
|
DEFAULT_LOGGER = Proc.new do
|
@@ -21,7 +27,7 @@ class PgLock
|
|
21
27
|
end
|
22
28
|
UnableToLock = UnableToLockError
|
23
29
|
|
24
|
-
def initialize(name:, attempts: 3, attempt_interval: 1, ttl: 60, connection:
|
30
|
+
def initialize(name:, attempts: 3, attempt_interval: 1, ttl: 60, connection: DEFAULT_CONNECTION_CONNECTOR.call, log: DEFAULT_LOGGER.call )
|
25
31
|
self.name = name
|
26
32
|
self.max_attempts = [attempts, 1].max
|
27
33
|
self.attempt_interval = attempt_interval
|
data/lib/pg_lock/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_lock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mikehale
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-10-
|
12
|
+
date: 2015-10-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pg
|