File tree Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Original file line number Diff line number Diff line change 4
4
(#478 )
5
5
* Time out after 10 seconds if starting the spring server doesn't work
6
6
(maybe related to #480 , #479 )
7
+ * Prevent infinite boot loop when trying to restart the spring server
8
+ due to client/server version mismatch (related to #479 )
7
9
8
10
## 1.7.0
9
11
Original file line number Diff line number Diff line change @@ -13,7 +13,9 @@ class Run < Command
13
13
14
14
def initialize ( args )
15
15
super
16
- @signal_queue = [ ]
16
+
17
+ @signal_queue = [ ]
18
+ @server_booted = false
17
19
end
18
20
19
21
def log ( message )
@@ -74,6 +76,8 @@ def boot_server
74
76
pid = Process . spawn ( gem_env , env . server_command , out : File ::NULL )
75
77
timeout = Time . now + BOOT_TIMEOUT
76
78
79
+ @server_booted = true
80
+
77
81
until env . socket_path . exist?
78
82
_ , status = Process . waitpid2 ( pid , Process ::WNOHANG )
79
83
@@ -89,6 +93,10 @@ def boot_server
89
93
end
90
94
end
91
95
96
+ def server_booted?
97
+ @server_booted
98
+ end
99
+
92
100
def gem_env
93
101
bundle = Bundler . bundle_path . to_s
94
102
paths = Gem . path + ENV [ "GEM_PATH" ] . to_s . split ( File ::PATH_SEPARATOR )
@@ -108,13 +116,17 @@ def stop_server
108
116
def verify_server_version
109
117
server_version = server . gets . chomp
110
118
if server_version != env . version
111
- $stderr. puts <<-ERROR
112
- There is a version mismatch between the spring client (#{ env . version } ) and the server (#{ server_version } ).
113
- Restarting to resolve.
114
- ERROR
119
+ $stderr. puts "There is a version mismatch between the spring client " \
120
+ "(#{ env . version } ) and the server (#{ server_version } )."
115
121
116
- stop_server
117
- cold_run
122
+ if server_booted?
123
+ $stderr. puts "We already tried to reboot the server, but the mismatch is still present."
124
+ exit 1
125
+ else
126
+ $stderr. puts "Restarting to resolve."
127
+ stop_server
128
+ cold_run
129
+ end
118
130
end
119
131
end
120
132
You can’t perform that action at this time.
0 commit comments