Skip to content

Commit db59ab1

Browse files
n1mmyglasser
authored andcommitted
wait for server to be running instead of naive sleep.
1 parent b2b5e32 commit db59ab1

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

examples/unfinished/benchmark/run-local.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,22 @@ pkill -f "$PROJDIR/.meteor/local/db" || true
2323
../../../meteor --production --settings "scenarios/${SCENARIO}.json" --port 9000 &
2424
OUTER_PID=$!
2525

26+
echo "Waiting for server to come up"
27+
function wait_for_port {
28+
local N=0
29+
while ! curl -v "$1" 2>&1 | grep ' 200 ' > /dev/null ; do
30+
sleep 1
31+
N=$(($N+1))
32+
if [ $N -ge $2 ] ; then
33+
echo "Timed out waiting for port $1"
34+
exit 2
35+
fi
36+
done
37+
}
38+
wait_for_port "http://localhost:9001" 60
2639

40+
41+
echo "Starting phantoms"
2742
# start a bunch of phantomjs processes
2843
PHANTOMSCRIPT=`mktemp -t benchmark-XXXXXXXX`
2944
cat > "$PHANTOMSCRIPT" <<EOF

0 commit comments

Comments
 (0)