diff --git a/lib/client.js b/lib/client.js index 6e8419a..e354df1 100644 --- a/lib/client.js +++ b/lib/client.js @@ -52,6 +52,9 @@ class ClawClient { // 最近一次 WS 错误是否是证书时间问题(NTP 未同步) this._certTimeError = false; + // 记录已为哪个 clawId 配置过 openclaw(防止 WS 重连时重复执行) + this._openClawConfigured = null; + // systemd watchdog this._sdTimer = null; @@ -391,7 +394,10 @@ class ClawClient { led.status.setApps(); led.display.showTime(); log.info('clawd', `已激活 claw_id = ${this._cfg.claw_id}`); - this._configureOpenClaw(this._cfg.claw_id); + if (this._cfg.claw_id && this._openClawConfigured !== this._cfg.claw_id) { + this._openClawConfigured = this._cfg.claw_id; + this._configureOpenClaw(this._cfg.claw_id); + } } }