Skip to content

Commit

Permalink
Make await-connectivity a little more reliable.
Browse files Browse the repository at this point in the history
The sleep 10 at the end is a crutch until we figure out why down-segments
take so long to get registered.
  • Loading branch information
jiceatscion committed Sep 3, 2024
1 parent 19e7330 commit 56d16d2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tools/await-connectivity
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ check_connectivity() {
for as in $cores; do
missing=$(comm -23 \
<(printf "%s\n" $cores | grep -v $as | sort) \
<(curl -sfS $(cs_api_url_segments "$as") | jq '.[].start_isd_as' -r | sort -u)
<(curl --connect-timeout 5 -sfS $(cs_api_url_segments "$as") | jq '.[].start_isd_as' -r | sort -u)
)
if [ -n "$missing" ]; then
echo "$as: waiting for" $missing
Expand All @@ -71,7 +71,7 @@ check_connectivity() {

# non-core ASes: wait for at least one (up-)segment
for as in $noncores; do
curl -sfS $(cs_api_url_segments "$as") | jq -e 'length > 0' > /dev/null || {
curl --connect-timeout 5 -sfS $(cs_api_url_segments "$as") | jq -e 'length > 0' > /dev/null || {
echo "$as waiting for up segment"
ret=1
}
Expand All @@ -88,16 +88,19 @@ main() {
local noncores=$(sed -n '/Non-core/,${s/^- //p}' gen/as_list.yml)

for i in $(seq 1 "$QUIET"); do
check_connectivity "$cores" "$noncores" > /dev/null && exit 0
check_connectivity "$cores" "$noncores" > /dev/null && return 0
sleep 1
done
for i in $(seq "$QUIET" $((TIMEOUT-1))); do
echo "Check after ${i}s"
check_connectivity "$cores" "$noncores" && exit 0
check_connectivity "$cores" "$noncores" && return 0
sleep 1
done
echo "Check after ${TIMEOUT}s"
check_connectivity "$cores" "$noncores" || { echo "Timeout, giving up"; exit 1; }
}

main "$@"

# that is not enough. Down segment registrations don't seem to happen fast.
sleep 10

0 comments on commit 56d16d2

Please sign in to comment.