just_one_lock 0.1.1 → 0.2.0
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/lib/just_one_lock/version.rb +1 -1
- data/lib/just_one_lock.rb +1 -1
- data/spec/just_one_lock/locking_object.rb +2 -2
- data/spec/spec_helper.rb +2 -2
- 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: 279edd5887b6cab66bb98750888a34874a01b326
|
4
|
+
data.tar.gz: 05ed51a2381bc20704ebcbe1f995ea9f1fbc8efc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14b521caf2b66a1f7604f799fc3c4a8b3db6ed161b05b560c7a82427e53fb25fd396384108d6608c9339ca08095435b5a5a28d6c1d0a0bf14c0aedbb9b623552
|
7
|
+
data.tar.gz: 9193f32028551b0455011a11bf9b8f08f0360657a482455cbfc783f4aaffe5e26fc8420e7c413d2ba8a81cf8d9ec9463196d0b1fe4c54f51429ab4d9f01a0a91
|
data/lib/just_one_lock.rb
CHANGED
@@ -91,7 +91,7 @@ shared_examples 'a locking object' do
|
|
91
91
|
dir, scope = dir_and_scope(lockpath)
|
92
92
|
|
93
93
|
pid = fork {
|
94
|
-
JustOneLock::prevent_multiple_executions(
|
94
|
+
JustOneLock::prevent_multiple_executions(scope, locker) do
|
95
95
|
sleep 10
|
96
96
|
end
|
97
97
|
}
|
@@ -105,7 +105,7 @@ shared_examples 'a locking object' do
|
|
105
105
|
answer = 0
|
106
106
|
|
107
107
|
thread = Thread.new {
|
108
|
-
JustOneLock::prevent_multiple_executions(
|
108
|
+
JustOneLock::prevent_multiple_executions(scope, locker) do
|
109
109
|
answer += 42
|
110
110
|
end
|
111
111
|
}
|
data/spec/spec_helper.rb
CHANGED
@@ -18,7 +18,7 @@ def parallel(n = 2, lockpath: Tempfile.new(['sample', '.lock']).path, &block)
|
|
18
18
|
|
19
19
|
(1..n).map do
|
20
20
|
Thread.new do
|
21
|
-
JustOneLock::prevent_multiple_executions(
|
21
|
+
JustOneLock::prevent_multiple_executions(scope, locker, &block)
|
22
22
|
end
|
23
23
|
end.map(&:join)
|
24
24
|
end
|
@@ -33,7 +33,7 @@ def parallel_forks(n = 2, lockpath: Tempfile.new(['sample', '.lock']).path, &blo
|
|
33
33
|
|
34
34
|
(1..n).map do
|
35
35
|
fork {
|
36
|
-
JustOneLock::prevent_multiple_executions(
|
36
|
+
JustOneLock::prevent_multiple_executions(scope, locker, &block)
|
37
37
|
}
|
38
38
|
end.map do |pid|
|
39
39
|
Process.waitpid(pid)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: just_one_lock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yury Kotov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|