From 1e73fdf4cff7fdffb8fb4ead02346f0174257fa1 Mon Sep 17 00:00:00 2001 From: steve-fischer-200 Date: Wed, 25 Mar 2026 09:31:30 -0400 Subject: [PATCH] fix error handling --- Model/bin/presenter_update.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Model/bin/presenter_update.sh b/Model/bin/presenter_update.sh index b7f05f0..78c9e50 100755 --- a/Model/bin/presenter_update.sh +++ b/Model/bin/presenter_update.sh @@ -12,26 +12,35 @@ wdkServer SiteSearchData $SERVER_PORT -cleanCacheAtStartup & echo "waiting for server to be available" +SERVER_AVAILABLE=false start=$(date +%s) while [ $(($(date +%s) - $start)) -lt 180 ] # while true do echo "checking port $SERVER_PORT..." - if nc -zv localhost:$SERVER_PORT + if nc -zv localhost:$SERVER_PORT then echo 'server available' + SERVER_AVAILABLE=true break fi sleep 1 done + +if [ "$SERVER_AVAILABLE" = false ]; then + echo "ERROR: Server on port $SERVER_PORT failed to become available after 180 seconds" >&2 + kill %1 2>/dev/null + exit 1 +fi + echo "$(date -u) server available" # make output dir and run commands to produce output -mkdir $DESTINATION_DIRECTORY &&\ -echo "$(date -u) starting ssCreateWdkRecordsBatch" &&\ -ssCreateWdkRecordsBatch dataset-presenter $PROJECT_ID http://localhost:$SERVER_PORT $DESTINATION_DIRECTORY --paramName projectId --paramValue $PROJECT_ID &&\ -echo "$(date -u) starting ssCreateWdkMetaBatch" &&\ +mkdir $DESTINATION_DIRECTORY +echo "$(date -u) starting ssCreateWdkRecordsBatch" +ssCreateWdkRecordsBatch dataset-presenter $PROJECT_ID http://localhost:$SERVER_PORT $DESTINATION_DIRECTORY --paramName projectId --paramValue $PROJECT_ID +echo "$(date -u) starting ssCreateWdkMetaBatch" ssCreateWdkMetaBatch $SITE_BASE_URL/service/ $PROJECT_ID $DESTINATION_DIRECTORY echo "produced files:"