lock-smith 0.0.1 → 0.0.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.
- data/lib/locksmith/{postgresql.rb → pg.rb} +4 -2
- data/readme.md +2 -2
- metadata +2 -2
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'zlib'
|
2
|
+
require 'uri'
|
2
3
|
module Locksmith
|
3
|
-
module
|
4
|
+
module Pg
|
5
|
+
extend self
|
4
6
|
BACKOFF = 0.5
|
5
7
|
|
6
8
|
def lock(name)
|
@@ -13,7 +15,7 @@ module Locksmith
|
|
13
15
|
end
|
14
16
|
return result
|
15
17
|
ensure
|
16
|
-
|
18
|
+
release_lock(i)
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
data/readme.md
CHANGED
@@ -40,8 +40,8 @@ Locksmith will use `pg_try_advisory_lock` to lock, no need for table creation.
|
|
40
40
|
ENV["DATABASE_URL"] = "postgresql://user:pass@localhost/database_name"
|
41
41
|
|
42
42
|
require 'pg'
|
43
|
-
require 'locksmith/
|
44
|
-
Locksmith::
|
43
|
+
require 'locksmith/pg'
|
44
|
+
Locksmith::Pg.lock("my-resource") do
|
45
45
|
puts("locked my-resource with PostgreSQL")
|
46
46
|
end
|
47
47
|
```
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lock-smith
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -20,7 +20,7 @@ files:
|
|
20
20
|
- lib/locksmith/config.rb
|
21
21
|
- lib/locksmith/dynamodb.rb
|
22
22
|
- lib/locksmith/log.rb
|
23
|
-
- lib/locksmith/
|
23
|
+
- lib/locksmith/pg.rb
|
24
24
|
- readme.md
|
25
25
|
homepage: http://github.com/ryandotsmith/lock-smith
|
26
26
|
licenses:
|