#!/bin/bash
port=8809

run_sim_perf_dashboard() {
    fuser -k $port/tcp
    bazel run --config=cuda -c opt //sim/metrics:performance_dashboard -- --server.port $port
}

until run_sim_perf_dashboard; do
    echo "Service crashed with exit code $?. Restarting in 5 seconds..." >&2
    sleep 5
done
