File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ def initialize(app_env)
6
6
@app_env = app_env
7
7
@spring_env = Env . new
8
8
@mutex = Mutex . new
9
+ @state = :running
9
10
end
10
11
11
12
def log ( message )
@@ -26,6 +27,7 @@ def start
26
27
end
27
28
28
29
def restart
30
+ return if @state == :stopping
29
31
start_child ( true )
30
32
end
31
33
@@ -74,7 +76,12 @@ def run(client)
74
76
end
75
77
76
78
def stop
77
- Process . kill ( 'TERM' , pid ) if pid
79
+ @state = :stopping
80
+
81
+ if pid
82
+ Process . kill ( 'TERM' , pid )
83
+ Process . wait ( pid )
84
+ end
78
85
end
79
86
80
87
private
Original file line number Diff line number Diff line change @@ -92,13 +92,13 @@ def set_exit_hook
92
92
end
93
93
94
94
def shutdown
95
- @applications . values . each ( &:stop )
96
-
97
95
[ env . socket_path , env . pidfile_path ] . each do |path |
98
96
if path . exist?
99
97
path . unlink rescue nil
100
98
end
101
99
end
100
+
101
+ @applications . values . map { |a | Thread . new { a . stop } } . map ( &:join )
102
102
end
103
103
104
104
def write_pidfile
You can’t perform that action at this time.
0 commit comments