mirror of
https://github.com/jketterl/openwebrx.git
synced 2026-04-13 18:35:25 +00:00
fix(dab): prevent cached_output overwrite by freq-correction-only packets
MetaProcessor.process() was replacing cached_output on every call with
whatever fields happened to be in the current EtiDecoder packet. Most
packets only contain timestamp + coarse/fine_frequency_shift — after
filtering those out, the replacement left cached_output as {"mode":"DAB"},
wiping out the previously cached programmes/ensemble data. This caused
the DAB programme list to stop loading in browsers ~1-2 minutes after
initial connect (when the first freq-correction packet arrived).
Fix: switch from assignment to dict.update(), merging only stable fields
(programmes, ensemble_label, etc.). Freq-correction-only packets produce
an empty stable set and no longer touch the cache.
Paired with the getCachedMeta()/setMetaWriter() injection from the PR #421
port, this ensures the programme list is reliably available to all clients.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4e4e013626
commit
02a3fd565e
1 changed files with 6 additions and 4 deletions
|
|
@ -44,10 +44,12 @@ class MetaProcessor(PickleModule):
|
|||
if not result:
|
||||
return
|
||||
result["mode"] = "DAB"
|
||||
# Keep a snapshot of stable fields so late-connecting clients can get them
|
||||
# immediately via setMetaWriter() injection. Exclude timestamp — it changes
|
||||
# every second and the injected copy would be stale anyway.
|
||||
self.cached_output = {k: v for k, v in result.items() if k != "timestamp"}
|
||||
# Merge only stable fields (programmes, ensemble_label, etc.) into the cache.
|
||||
# Do NOT replace the whole dict — freq-correction-only packets have no
|
||||
# stable fields and would wipe out previously cached programme data.
|
||||
stable = {k: v for k, v in result.items() if k not in ("timestamp", "mode")}
|
||||
if stable:
|
||||
self.cached_output.update(stable)
|
||||
return result
|
||||
|
||||
def _nudgeShift(self, amount):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue