fix(sync): the stored RSS warning says what the API fallback read

An INFO line outside a request never reaches log_events, so the fallback's
own summary was invisible in the Server log. Its counts ride on the
sync.rss.failed warning, the one line of a poll the console keeps.
Measured on localdev: 375 of 375 dark channels read, 403 new videos.
This commit is contained in:
2026-09-19 05:05:13 +02:00
parent 6cb8231a9f
commit 582f20fab6
2 changed files with 13 additions and 2 deletions
+6 -1
View File
@@ -235,7 +235,9 @@ class TestRssPollResult:
with pytest.raises(RuntimeError, match="read-only transaction"):
self._run(monkeypatch, fetch=lambda cid: [{"id": "v"}], apply_=boom)
def test_only_the_unreadable_feeds_go_to_the_api_and_what_it_reads_counts(self, monkeypatch):
def test_only_the_unreadable_feeds_go_to_the_api_and_what_it_reads_counts(
self, monkeypatch, caplog
):
# A feed that answered 404 is the fallback's; a channel whose rows failed to STORE is not —
# the API would hand the same rows to the same broken write.
seen = []
@@ -262,6 +264,9 @@ class TestRssPollResult:
)
assert seen == ["UC_dark"]
assert out == {"new": 4, "failed": 2, "fallback": 1}
# ...and the one line the stored log keeps says so (an INFO line outside a request is not).
(warning,) = [r for r in caplog.records if getattr(r, "event", None) == "sync.rss.failed"]
assert warning.attrs["fallback_read"] == 1 and warning.attrs["fallback_new"] == 3
def test_no_channels_at_all_is_not_an_outage(self, monkeypatch):
# A fresh instance with nothing subscribed must not report an error every poll.