Skip to content

Commit dc01458

Browse files
committed
allow network synchronization to be null.
1 parent b7fbde1 commit dc01458

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

action.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,31 +52,37 @@ runs:
5252
run: |
5353
set -eo pipefail
5454
docker run -d --name ${{ inputs.container-name }} -p ${{ inputs.ogmios-port }}:1337 -v ${{ inputs.db-dir }}:/db ${{ steps.docker-image.outputs.image }}
55-
sleep 3
55+
sleep 10
5656
URL=http://localhost:$OGMIOS_PORT/health
5757
echo "Begin synchronization, target: $THRESHOLD"
58-
echo ""
58+
echo -n ""
5959
for (( ;; ))
6060
do
6161
HEALTH=$(curl -sS $URL)
6262
NETWORK_SYNCHRONIZATION=$(sed 's/.*"networkSynchronization":\([0-9]\+\.\?[0-9]*\).*/\1/' <<< $HEALTH)
6363
6464
RE='^[0-9]+\.?[0-9]*$'
6565
if ! [[ $NETWORK_SYNCHRONIZATION =~ $RE ]] ; then
66-
echo "error: unexpected response from /health endpoint: $HEALTH"
67-
exit 1
66+
if [[ $HEALTH == *"\"networkSynchronization\":null"* ]]; then
67+
echo -ne "\rServer isn't ready..."
68+
sleep 5
69+
continue
70+
else
71+
echo "error: unexpected response from /health endpoint: $HEALTH"
72+
exit 1
73+
fi
6874
fi
6975
70-
echo -e "\rnetwork synchronization: $NETWORK_SYNCHRONIZATION"
76+
echo -ne "\rnetwork synchronization: $NETWORK_SYNCHRONIZATION"
7177
PREDICATE=$(bc <<< "$NETWORK_SYNCHRONIZATION >= $THRESHOLD")
7278
7379
if [ "$PREDICATE" -eq 1 ]; then
80+
echo "Done."
7481
exit 0
7582
else
7683
sleep 5
7784
fi
7885
done
79-
echo -e "\rDone."
8086
8187
- name: 🧹 Cleanup
8288
run: |

0 commit comments

Comments
 (0)