fix(connection): abort module config fetch on connectivity loss (#3637)#3638
Conversation
…event stuck moduleConfigsEverFetched (#3637) requestAllModuleConfigs() silently swallowed "Not connected" errors in its loop, so moduleConfigsEverFetched was set to true even when all 15 requests failed due to a mid-fetch disconnect. On subsequent reconnects the fetch was skipped entirely, leaving users unable to TX until a full process restart. Propagate connectivity errors out of the loop (both via a pre-iteration isConnected guard and by re-throwing "Not connected" from the catch), so the caller never sets moduleConfigsEverFetched=true on a failed run and the fetch retries cleanly on the next reconnection. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XQytw5q5QAjuivoaDqdzPt
|
Claude finished @Yeraze's task —— View job PR Review
SummaryThe fix is correct and well-scoped. The root cause analysis in the PR description is accurate: What changed (
|
Summary
Fixes #3637 — random node disconnects / TX failures since 4.11.x.
requestAllModuleConfigs()(added in 4.11.0 for backup capability) silently swallowed"Not connected to Meshtastic node"errors inside its 15-request loop. If the device dropped the TCP connection mid-fetch, all remaining requests failed quietly, thenmoduleConfigsEverFetched = truewas set anyway. On every subsequent reconnect the fetch was skipped ("already fetched this session"), leaving the flag stuck and the module configs permanently incomplete until a process restart.isConnectedguard that throws early if the connection is gone, and changed the catch block to re-throw connectivity errors instead of swallowing them. The caller'stry/catchsees the failure,moduleConfigsEverFetchedstaysfalse, and the fetch retries cleanly on the next reconnection.The log fingerprint in the issue (
✅ All module config requests sentimmediately before TX failures) is caused by the loop completing after all 15 requests silently failed — that misleading success log now only appears when all requests actually succeed.Changes
src/server/meshtasticManager.ts: 15-line change torequestAllModuleConfigs()loop error handlingTest plan
tsc --noEmit) ✅ confirmed before PR📦 Requesting all module configs for backup...in logs ~50s after connect; simulate a disconnect mid-fetch and confirmmoduleConfigsEverFetchedis not set (next reconnect re-attempts the fetch rather than skipping it)🤖 Generated with Claude Code
https://claude.ai/code/session_01XQytw5q5QAjuivoaDqdzPt
Generated by Claude Code