refactor(observe): stop tearing down live sessions on data-drift or poll hiccups
Replace the breadth/silence downgrade heuristic with a simpler rule: a still-live OBSERVE session is never torn down on a sweep/cache mismatch (the 30s sweep already corrects the cache regardless of mode) -- only a proven reconnect invalidates subscriptions. A mismatch instead triggers extra hot/warm subpolls this cycle as a bounded fallback. Also stop treating a summary-poll block-level ACK timeout as session death: distinguish TimeoutError (transfer was progressing, session likely alive) from ConnectionError (session actually closed), backed by a consecutive-timeout counter so a genuinely dead channel still recovers. This was causing a flaky/slow device (e.g. a dishwasher) to flap observe<->poll every ~45s on nothing but a slow blockwise GET. Also remove the dead is_active/active_when scaffolding (never wired into the coordinator) and add DEBUG logging for each OBSERVE notify received, including its href.
This commit is contained in:
1 parent
7024b170fe
commit
569029c116
13 files changed
+745
-93
No files matched your search
@@ -2,7 +2,7 @@ import pytest
|
||||
from tests.conftest import _load_device
|
||||
from custom_components.localthings.registry.by_type import for_device, _type_key
|
||||
from custom_components.localthings.registry.discovery import discover
|
||||
from custom_components.localthings.registry.adapter import flatten, is_active
|
||||
from custom_components.localthings.registry.adapter import flatten
|
||||
|
||||
|
||||
@pytest.mark.parametrize('name,expected_type_key', [
|
||||
@@ -24,5 +24,3 @@ def test_full_pipeline_v2(name, expected_type_key):
|
||||
|
||||
state = flatten(bound, resources)
|
||||
assert state
|
||||
# is_active returns bool; just verify it runs without error
|
||||
is_active(bound, resources)
|
||||
Reference in new issue
Block a user