From 8a7d80d995ebd88cb9d7ab0d86a068dd0d732926 Mon Sep 17 00:00:00 2001 From: haoyuren <13851610112@163.com> Date: Sun, 29 Mar 2026 16:36:23 -0500 Subject: Send heartbeat from poller loop, not just hooks --- poll_and_notify.sh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'poll_and_notify.sh') diff --git a/poll_and_notify.sh b/poll_and_notify.sh index 7849b58..b32a273 100755 --- a/poll_and_notify.sh +++ b/poll_and_notify.sh @@ -16,6 +16,11 @@ while IFS=$'\t' read -r SESSION PROJECT_DIR; do [ -z "$SESSION" ] && continue tmux has-session -t "$SESSION" 2>/dev/null || continue + # 发心跳(每次 poll 都发,不依赖 Claude 活跃) + curl -sf -X POST -H "Authorization: Bearer $API_SECRET" -H "Content-Type: application/json" \ + -d "{\"session\": \"$SESSION\", \"host\": \"$(hostname)\"}" \ + "$BROKER_URL/heartbeat" >/dev/null 2>&1 || true + COUNT=$(curl -sf -H "Authorization: Bearer $API_SECRET" \ "$BROKER_URL/tasks/pending?target=$SESSION" 2>/dev/null \ | python3 -c "import sys,json; print(len(json.load(sys.stdin).get('tasks',[])))" 2>/dev/null \ -- cgit v1.2.3