distributed_mutex 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/mysql_mutex.rb +5 -10
  3. metadata +4 -4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.1
1
+ 1.1.2
data/lib/mysql_mutex.rb CHANGED
@@ -85,6 +85,7 @@ class MySQLMutex < DistributedMutex
85
85
  end
86
86
 
87
87
  at_exit do
88
+ rails_logger = defined?(Rails) && Rails.respond_to?(:logger) && Rails.logger
88
89
  begin
89
90
  locks = MySQLMutex.active_locks
90
91
  locks.delete_if do |k, v|
@@ -92,21 +93,15 @@ at_exit do
92
93
  end
93
94
 
94
95
  if locks.size > 0
95
- if defined?(Rails)
96
- Rails.logger.error("MySQLMutex: Locks still active! - #{locks.inspect}")
96
+ if rails_logger
97
+ rails_logger.error("MySQLMutex: Locks still active! - #{locks.inspect}")
97
98
  else
98
99
  STDERR.puts("MySQLMutex: Locks still active! - #{locks.inspect}")
99
100
  end
100
- else
101
- if defined?(Rails)
102
- Rails.logger.debug("MySQLMutex: All locks released.")
103
- else
104
- STDERR.puts("MySQLMutex: All locks released.")
105
- end
106
101
  end
107
102
  rescue => err
108
- if defined?(Rails)
109
- Rails.logger.error("MySQLMutex: #{err.message}")
103
+ if rails_logger
104
+ rails_logger.error("MySQLMutex: #{err.message}")
110
105
  else
111
106
  STDERR.puts("MySQLMutex: #{err.message}")
112
107
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: distributed_mutex
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 1
10
- version: 1.1.1
9
+ - 2
10
+ version: 1.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Birkir A. Barkarson
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-29 00:00:00 +09:00
18
+ date: 2011-11-08 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies: []
21
21