File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
lib/ood_core/batch_connect/templates Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,8 @@ def run_script
134
134
def after_script
135
135
websockify_cmd = context . fetch ( :websockify_cmd , "${WEBSOCKIFY_CMD:-/opt/websockify/run}" ) . to_s
136
136
websockify_hb = context . fetch ( :websockify_heartbeat_seconds , "${WEBSOCKIFY_HEARTBEAT_SECONDS:-30}" ) . to_s
137
-
137
+ websockify_timeout_seconds = context . fetch ( :websockify_timeout_seconds , '${WEBSOCKIFY_TIMEOUT_SECONDS:-10}' ) . to_s
138
+
138
139
<<-EOT . gsub ( /^ {14}/ , "" )
139
140
#{ super }
140
141
@@ -146,6 +147,7 @@ def after_script
146
147
#{ websockify_cmd } $1 --heartbeat=#{ websockify_hb } $2 &> $log_file &
147
148
local ws_pid=$!
148
149
local counter=0
150
+ local max_timeout=#{ websockify_timeout_seconds }
149
151
150
152
# wait till websockify has successfully started
151
153
echo "[websockify]: pid: $ws_pid (proxying $1 ==> $2)" >&2
@@ -156,9 +158,9 @@ def after_script
156
158
if ! ps $ws_pid > /dev/null; then
157
159
echo "[websockify]: failed to launch!" >&2
158
160
return 1
159
- elif [ $counter -ge 10 ]; then
160
- # timeout after ~10 seconds
161
- echo "[websockify]: timed-out :(!" >&2
161
+ elif [ $counter -ge $max_timeout ]; then
162
+ # timeout after max_timeout seconds
163
+ echo "[websockify]: timed-out after $max_timeout seconds :(!" >&2
162
164
return 1
163
165
else
164
166
sleep 1
You can’t perform that action at this time.
0 commit comments