arya-mongrel_proctitle 1.3.3 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mongrel_proctitle.rb +5 -18
- metadata +1 -1
data/lib/mongrel_proctitle.rb
CHANGED
@@ -12,11 +12,7 @@ module Mongrel
|
|
12
12
|
@request_threads = []
|
13
13
|
@queue_length = 0
|
14
14
|
@request_count = 0
|
15
|
-
|
16
|
-
@last_request_finished_in = nil
|
17
|
-
@last_request_str = nil
|
18
|
-
@slowest_finished_in = nil
|
19
|
-
@slowest_request_str = nil
|
15
|
+
|
20
16
|
@updater_thread = Thread.new do
|
21
17
|
while true
|
22
18
|
@mutex.synchronize do
|
@@ -55,15 +51,9 @@ module Mongrel
|
|
55
51
|
@queue_length -= 1
|
56
52
|
@request_count += 1
|
57
53
|
|
58
|
-
@
|
59
|
-
@last_request_finished_at = Time.now.to_f
|
54
|
+
@last_time = Time.now.to_f - Thread.current[:arrived_at]
|
60
55
|
@last_request_str = Thread.current[:request_str]
|
61
|
-
|
62
|
-
if @slowest_finished_in.nil? || @slowest_finished_in < @last_request_finished_in
|
63
|
-
@slowest_finished_in = @last_request_finished_in
|
64
|
-
@slowest_request_str = @last_request_str
|
65
|
-
end
|
66
|
-
|
56
|
+
|
67
57
|
@request_threads.delete(Thread.current)
|
68
58
|
set_request_list_title
|
69
59
|
end
|
@@ -102,11 +92,8 @@ module Mongrel
|
|
102
92
|
|
103
93
|
# Reports process as being idle.
|
104
94
|
def set_idle
|
105
|
-
str = "idle
|
106
|
-
|
107
|
-
extra << "last #{time_delta_abbriv(@last_request_finished_in)} #{@last_request_str}" if @last_request_finished_in && @last_request_str
|
108
|
-
extra << "slowest #{time_delta_abbriv(@slowest_finished_in)} #{@slowest_request_str}" if @slowest_finished_in && @slowest_request_str
|
109
|
-
str << " [#{extra.join(", ")}]" unless extra.empty?
|
95
|
+
str = "idle#{' '*20}"
|
96
|
+
str << "[last #{time_delta_abbriv(@last_time)} #{@last_request_str}]" if @last_time && @last_request_str
|
110
97
|
self.title = str
|
111
98
|
end
|
112
99
|
|