ey_snaplock 0.0.10 → 0.0.11.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ey_snaplock/database/mysql.rb +5 -1
- data/lib/ey_snaplock/timer.rb +15 -0
- data/lib/ey_snaplock/version.rb +1 -1
- data/lib/ey_snaplock.rb +2 -2
- metadata +19 -16
@@ -7,6 +7,10 @@ module EY
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def lock_filename
|
10
|
+
p '######'
|
11
|
+
p ENV["MYSQL_LOCK_FILENAME"]
|
12
|
+
p File.read(ENV["MYSQL_LOCK_FILENAME"])
|
13
|
+
p '$$$$$$'
|
10
14
|
ENV["MYSQL_LOCK_FILENAME"] || "/db/mysql/.ey_snaplock.pid"
|
11
15
|
end
|
12
16
|
|
@@ -31,7 +35,7 @@ module EY
|
|
31
35
|
pipe = IO.popen(@mysql, 'w')
|
32
36
|
@read_lock_pid = pipe.pid
|
33
37
|
pipe.puts('flush tables with read lock;')
|
34
|
-
|
38
|
+
EY::Snaplock::Timer.timeout(timeout) do
|
35
39
|
until locked?
|
36
40
|
sleep 1
|
37
41
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module EY
|
2
|
+
class Snaplock
|
3
|
+
class Timer
|
4
|
+
def self.timeout(sec)
|
5
|
+
if RUBY_VERSION =~ /^1\.8/
|
6
|
+
require 'system_timer'
|
7
|
+
SystemTimer.timeout_after(sec) { yield }
|
8
|
+
else
|
9
|
+
require 'timeout'
|
10
|
+
Timeout.timeout(sec) { yield }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/ey_snaplock/version.rb
CHANGED
data/lib/ey_snaplock.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'net/http'
|
2
2
|
require 'net/https'
|
3
3
|
require 'ey_snaplock/database'
|
4
|
-
require '
|
4
|
+
require 'ey_snaplock/timer'
|
5
5
|
|
6
6
|
module EY
|
7
7
|
class Snaplock
|
@@ -52,7 +52,7 @@ module EY
|
|
52
52
|
def timeout
|
53
53
|
lambda do
|
54
54
|
begin
|
55
|
-
|
55
|
+
EY::Snaplock::Timer.timeout(REQUEST_TIMEOUT) { yield }
|
56
56
|
rescue Timeout::Error
|
57
57
|
$stderr.puts "Timeout Exceeded: Callback request took longer than #{REQUEST_TIMEOUT} seconds."
|
58
58
|
raise
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ey_snaplock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 961916008
|
5
|
+
prerelease: 7
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
|
9
|
+
- 11
|
10
|
+
- pre
|
11
|
+
version: 0.0.11.pre
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Engine Yard
|
@@ -15,8 +16,7 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date:
|
19
|
-
default_executable:
|
19
|
+
date: 2012-02-10 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: addressable
|
@@ -58,12 +58,13 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
hash:
|
61
|
+
hash: 11
|
62
62
|
segments:
|
63
63
|
- 0
|
64
|
-
-
|
65
|
-
-
|
66
|
-
|
64
|
+
- 9
|
65
|
+
- 2
|
66
|
+
- 2
|
67
|
+
version: 0.9.2.2
|
67
68
|
type: :development
|
68
69
|
version_requirements: *id003
|
69
70
|
- !ruby/object:Gem::Dependency
|
@@ -140,11 +141,11 @@ files:
|
|
140
141
|
- lib/ey_snaplock/database/mysql.rb
|
141
142
|
- lib/ey_snaplock/database/postgresql9.rb
|
142
143
|
- lib/ey_snaplock/database.rb
|
144
|
+
- lib/ey_snaplock/timer.rb
|
143
145
|
- lib/ey_snaplock/version.rb
|
144
146
|
- lib/ey_snaplock.rb
|
145
147
|
- LICENSE
|
146
148
|
- README.md
|
147
|
-
has_rdoc: true
|
148
149
|
homepage:
|
149
150
|
licenses: []
|
150
151
|
|
@@ -165,16 +166,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
165
166
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
167
|
none: false
|
167
168
|
requirements:
|
168
|
-
- - "
|
169
|
+
- - ">"
|
169
170
|
- !ruby/object:Gem::Version
|
170
|
-
hash:
|
171
|
+
hash: 25
|
171
172
|
segments:
|
172
|
-
-
|
173
|
-
|
173
|
+
- 1
|
174
|
+
- 3
|
175
|
+
- 1
|
176
|
+
version: 1.3.1
|
174
177
|
requirements: []
|
175
178
|
|
176
179
|
rubyforge_project:
|
177
|
-
rubygems_version: 1.
|
180
|
+
rubygems_version: 1.8.6
|
178
181
|
signing_key:
|
179
182
|
specification_version: 3
|
180
183
|
summary: Server side components for Engine Yard's snapshotting process
|