You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: unify HA Discovery retry state into a single map
HaDiscovery tracked TREEXML retry plumbing across two parallel Maps
(_treeWatchdogs and _treeRetryState) keyed identically on networkId,
with three near-duplicate cleanup helpers and a keepAttempts boolean
toggle that smelled of squashed operations.
Collapse to a single _treeRequestState Map whose value is
{ attempts, watchdogHandle, retryHandle }. The cleanup helpers reduce
to one parameterised _clearTimer and a _clearTreeState entry-killer;
the boolean parameter goes away. handleTreeStart's "successful response"
path is now a single _clearTreeState call, which both releases timers
and resets the attempts counter for any future failure.
Drop the typeof === 'function' guards in BridgeInitializationService
around haDiscovery.handleCommandError and haDiscovery.stop — both are
part of the class contract and the bridge holds a locally constructed
instance, so the guards traded clarity for hypothetical safety. The
test mock is updated to match the contract.
Behaviour unchanged; full suite (1172 tests) passes.
Bumps to 1.8.3.
Copy file name to clipboardExpand all lines: homeassistant-addon/CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,12 @@ All notable changes to the C-Gate Web Bridge Home Assistant add-on will be docum
5
5
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
8
+
## [1.8.3] - 2026-05-04
9
+
10
+
### Refactor
11
+
-**HA Discovery retry state**: collapsed the parallel `_treeWatchdogs` and `_treeRetryState` Maps in `HaDiscovery` into a single `_treeRequestState` Map (`networkId -> { attempts, watchdogHandle, retryHandle }`), eliminating duplicate lookups, an awkward `keepAttempts` boolean parameter, and three near-duplicate cleanup helpers. Behaviour is unchanged.
12
+
- Removed unnecessary `typeof === 'function'` guards around `haDiscovery.handleCommandError` and `haDiscovery.stop` calls in `BridgeInitializationService`; the methods are part of the class contract and the bridge holds a locally constructed instance.
0 commit comments