runit-man 2.0.6 → 2.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/runit-man/log_location_cache.rb +12 -8
- data/lib/runit-man/version.rb +1 -1
- metadata +4 -4
@@ -1,5 +1,5 @@
|
|
1
1
|
class LogLocationCache
|
2
|
-
TIME_LIMIT =
|
2
|
+
TIME_LIMIT = 600
|
3
3
|
|
4
4
|
def initialize(logger)
|
5
5
|
@logger = logger
|
@@ -8,10 +8,12 @@ class LogLocationCache
|
|
8
8
|
|
9
9
|
def [](pid)
|
10
10
|
pid = pid.to_i
|
11
|
+
loc = nil
|
11
12
|
unless pids.include?(pid)
|
12
|
-
|
13
|
+
loc = get_pid_location(pid)
|
14
|
+
set_pid_log_location(pid, loc)
|
13
15
|
end
|
14
|
-
pids[pid][:value]
|
16
|
+
loc || pids[pid][:value]
|
15
17
|
end
|
16
18
|
|
17
19
|
private
|
@@ -27,7 +29,7 @@ private
|
|
27
29
|
|
28
30
|
def remove_old_values
|
29
31
|
self.query_counter = query_counter + 1
|
30
|
-
if query_counter <
|
32
|
+
if query_counter < 10
|
31
33
|
return
|
32
34
|
end
|
33
35
|
self.query_counter = 0
|
@@ -91,10 +93,12 @@ private
|
|
91
93
|
|
92
94
|
def set_pid_log_location(pid, log_location)
|
93
95
|
remove_old_values
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
96
|
+
if log_location =~ /current$/
|
97
|
+
pids[pid.to_i] = {
|
98
|
+
:value => log_location,
|
99
|
+
:time => Time.now
|
100
|
+
}
|
101
|
+
end
|
98
102
|
self
|
99
103
|
end
|
100
104
|
end
|
data/lib/runit-man/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: runit-man
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 2.0.
|
9
|
+
- 7
|
10
|
+
version: 2.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Akzhan Abdulin
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04-
|
18
|
+
date: 2011-04-20 00:00:00 +04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|