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
134134 def after_script
135135 websockify_cmd = context . fetch ( :websockify_cmd , "${WEBSOCKIFY_CMD:-/opt/websockify/run}" ) . to_s
136136 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+
138139 <<-EOT . gsub ( /^ {14}/ , "" )
139140 #{ super }
140141
@@ -146,6 +147,7 @@ def after_script
146147 #{ websockify_cmd } $1 --heartbeat=#{ websockify_hb } $2 &> $log_file &
147148 local ws_pid=$!
148149 local counter=0
150+ local max_timeout=#{ websockify_timeout_seconds }
149151
150152 # wait till websockify has successfully started
151153 echo "[websockify]: pid: $ws_pid (proxying $1 ==> $2)" >&2
@@ -156,9 +158,9 @@ def after_script
156158 if ! ps $ws_pid > /dev/null; then
157159 echo "[websockify]: failed to launch!" >&2
158160 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
162164 return 1
163165 else
164166 sleep 1
You can’t perform that action at this time.
0 commit comments