feat: 清理openspec
This commit is contained in:
@@ -188,54 +188,6 @@ wait_for_url() {
|
||||
return 1
|
||||
}
|
||||
|
||||
wait_for_run_registration() {
|
||||
local attempts="${1:-45}"
|
||||
local run_pid_file="$LOCAL_DEBUG_PID_DIR/run.pid"
|
||||
printf 'waiting for run endpoint %s registration\n' "$RUN_ENDPOINT_ID"
|
||||
for _ in $(seq 1 "$attempts"); do
|
||||
if ! managed_pid_running "$run_pid_file"; then
|
||||
printf 'run exited before endpoint registration; see %s\n' "$LOCAL_DEBUG_LOG_DIR/run.log" >&2
|
||||
return 1
|
||||
fi
|
||||
if run_endpoint_has_recent_heartbeat; then
|
||||
printf 'run endpoint %s is registered\n' "$RUN_ENDPOINT_ID"
|
||||
return 0
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
printf 'run endpoint %s did not register before timeout\n' "$RUN_ENDPOINT_ID" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
run_endpoint_has_recent_heartbeat() {
|
||||
[[ -f "$PLATFORM_METADATA_PATH" ]] || return 1
|
||||
node -e '
|
||||
const fs = require("fs");
|
||||
const metadata = JSON.parse(fs.readFileSync(process.argv[1], "utf8"));
|
||||
const endpointID = process.argv[2];
|
||||
function findEndpoint(value) {
|
||||
if (!value || typeof value !== "object") return null;
|
||||
if ((value.ID || value.id) === endpointID && (value.LastHeartbeatAt || value.lastHeartbeatAt)) return value;
|
||||
if (Array.isArray(value)) {
|
||||
for (const item of value) {
|
||||
const found = findEndpoint(item);
|
||||
if (found) return found;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
for (const item of Object.values(value)) {
|
||||
const found = findEndpoint(item);
|
||||
if (found) return found;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
const endpoint = findEndpoint(metadata);
|
||||
const heartbeat = endpoint && (endpoint.LastHeartbeatAt || endpoint.lastHeartbeatAt);
|
||||
const ageMilliseconds = heartbeat ? Date.now() - Date.parse(heartbeat) : Number.POSITIVE_INFINITY;
|
||||
process.exit(Number.isFinite(ageMilliseconds) && ageMilliseconds >= 0 && ageMilliseconds < 30000 ? 0 : 1);
|
||||
' "$PLATFORM_METADATA_PATH" "$RUN_ENDPOINT_ID"
|
||||
}
|
||||
|
||||
printf 'local debug root: %s\n' "$LOCAL_DEBUG_ROOT"
|
||||
printf 'platform: %s\n' "$(local_debug_platform_url)"
|
||||
printf 'platform_web: %s\n' "$(local_debug_web_url)"
|
||||
@@ -303,8 +255,6 @@ start_service run "$(dirname "$RUN_BOOTSTRAP_BIN")" env \
|
||||
RUN_RETRY_BACKOFF_MS="$RUN_RETRY_BACKOFF_MS" \
|
||||
"$RUN_BOOTSTRAP_BIN"
|
||||
|
||||
wait_for_run_registration
|
||||
|
||||
cat <<EOF
|
||||
|
||||
Local debug stack requested.
|
||||
|
||||
Reference in New Issue
Block a user