Skip to content

Commit c84cc85

Browse files
authored
Docker: Video record extract last session from json response (#2602)
* Docker: Video record extract last session from json response * Stop video when session is interrupted --------- Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
1 parent e9c4c3d commit c84cc85

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Video/video.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ ts_format=${SE_LOG_TIMESTAMP_FORMAT:-"%Y-%m-%d %H:%M:%S,%3N"}
2222
process_name="video.recorder"
2323

2424
if [ "${SE_VIDEO_RECORD_STANDALONE}" = "true" ]; then
25-
JQ_SESSION_ID_QUERY=".value.nodes[]?.slots[]?.session?.sessionId"
25+
JQ_SESSION_ID_QUERY=".value.nodes[-1]?.slots[-1]?.session?.sessionId"
2626
SE_NODE_PORT=${SE_NODE_PORT:-"4444"}
2727
NODE_STATUS_ENDPOINT="$(/opt/bin/video_gridUrl.sh)/status"
2828
else
29-
JQ_SESSION_ID_QUERY=".[]?.node?.slots | .[0]?.session?.sessionId"
29+
JQ_SESSION_ID_QUERY=".[-1]?.node?.slots | .[-1]?.session?.sessionId"
3030
SE_NODE_PORT=${SE_NODE_PORT:-"5555"}
3131
NODE_STATUS_ENDPOINT="${SE_SERVER_PROTOCOL}://${DISPLAY_CONTAINER_NAME}:${SE_NODE_PORT}/status"
3232
fi
@@ -259,7 +259,7 @@ else
259259
fi
260260
echo "$(date -u +"${ts_format}") [${process_name}] - Video recording started"
261261
sleep ${poll_interval}
262-
elif [[ "$session_id" != "$prev_session_id" && "$recording_started" = "true" ]]; then
262+
elif [[ "$recording_started" = "true" && ( "$session_id" != "$prev_session_id" || "$session_id" == "null" || "$session_id" == "" ) ]]; then
263263
stop_recording
264264
wait_for_file_integrity
265265
if [[ $max_recorded_count -gt 0 ]] && [[ $recorded_count -ge $max_recorded_count ]]; then

Video/video_graphQLQuery.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
max_time=1
4-
retry_time=3
4+
retry_time=2
55

66
# Define parameters
77
SESSION_ID=$1

0 commit comments

Comments
 (0)