distributed_mutex 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +4 -5
- data/VERSION +1 -1
- data/lib/mysql_mutex.rb +19 -11
- data/spec/spec_helper.rb +0 -1
- metadata +11 -8
data/Rakefile
CHANGED
@@ -17,13 +17,12 @@ rescue LoadError
|
|
17
17
|
end
|
18
18
|
|
19
19
|
begin
|
20
|
-
require '
|
20
|
+
require 'rspec/core/rake_task'
|
21
21
|
|
22
|
-
|
23
|
-
t.
|
24
|
-
t.
|
22
|
+
RSpec::Core::RakeTask.new('spec') do |t|
|
23
|
+
t.rspec_opts = ["-fd", "-c"]
|
24
|
+
t.pattern = 'spec/**/*_spec.rb'
|
25
25
|
end
|
26
|
-
|
27
26
|
rescue LoadError
|
28
27
|
desc 'Spec rake task not available'
|
29
28
|
task :spec do
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.1
|
data/lib/mysql_mutex.rb
CHANGED
@@ -85,22 +85,30 @@ class MySQLMutex < DistributedMutex
|
|
85
85
|
end
|
86
86
|
|
87
87
|
at_exit do
|
88
|
-
|
89
|
-
|
90
|
-
v
|
91
|
-
|
88
|
+
begin
|
89
|
+
locks = MySQLMutex.active_locks
|
90
|
+
locks.delete_if do |k, v|
|
91
|
+
v.empty?
|
92
|
+
end
|
92
93
|
|
93
|
-
|
94
|
-
|
95
|
-
|
94
|
+
if locks.size > 0
|
95
|
+
if defined?(Rails)
|
96
|
+
Rails.logger.error("MySQLMutex: Locks still active! - #{locks.inspect}")
|
97
|
+
else
|
98
|
+
STDERR.puts("MySQLMutex: Locks still active! - #{locks.inspect}")
|
99
|
+
end
|
96
100
|
else
|
97
|
-
|
101
|
+
if defined?(Rails)
|
102
|
+
Rails.logger.debug("MySQLMutex: All locks released.")
|
103
|
+
else
|
104
|
+
STDERR.puts("MySQLMutex: All locks released.")
|
105
|
+
end
|
98
106
|
end
|
99
|
-
|
107
|
+
rescue => err
|
100
108
|
if defined?(Rails)
|
101
|
-
Rails.logger.
|
109
|
+
Rails.logger.error("MySQLMutex: #{err.message}")
|
102
110
|
else
|
103
|
-
STDERR.puts("MySQLMutex:
|
111
|
+
STDERR.puts("MySQLMutex: #{err.message}")
|
104
112
|
end
|
105
113
|
end
|
106
114
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: distributed_mutex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 17
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 1
|
7
8
|
- 1
|
8
|
-
-
|
9
|
-
version: 1.1.
|
9
|
+
- 1
|
10
|
+
version: 1.1.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Birkir A. Barkarson
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date:
|
18
|
+
date: 2011-09-29 00:00:00 +09:00
|
18
19
|
default_executable:
|
19
20
|
dependencies: []
|
20
21
|
|
@@ -51,27 +52,29 @@ rdoc_options: []
|
|
51
52
|
require_paths:
|
52
53
|
- lib
|
53
54
|
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
54
56
|
requirements:
|
55
57
|
- - ">="
|
56
58
|
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
57
60
|
segments:
|
58
61
|
- 0
|
59
62
|
version: "0"
|
60
63
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
61
65
|
requirements:
|
62
66
|
- - ">="
|
63
67
|
- !ruby/object:Gem::Version
|
68
|
+
hash: 3
|
64
69
|
segments:
|
65
70
|
- 0
|
66
71
|
version: "0"
|
67
72
|
requirements: []
|
68
73
|
|
69
74
|
rubyforge_project:
|
70
|
-
rubygems_version: 1.3.
|
75
|
+
rubygems_version: 1.3.7
|
71
76
|
signing_key:
|
72
77
|
specification_version: 3
|
73
78
|
summary: API for using a unique mutex across all instances of your application.
|
74
|
-
test_files:
|
75
|
-
|
76
|
-
- spec/mysql_mutex_spec.rb
|
77
|
-
- spec/spec_helper.rb
|
79
|
+
test_files: []
|
80
|
+
|