[Bug]: A short (non-empty) provider response still deletes auto-synced channels

Open
#1,862 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
57/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python, redis
Domain
backend, databases

Research direction

Start in apps/m3u/tasks.py around lines 3914–3938 and trace how the refresh counts parsed streams before stale marking, cleanup_streams, and sync_auto_channels. Check how Redis stores the last accepted count and how refresh failures are handled. Reproduce with a short provider response, then verify that responses below the stated threshold skip destructive sync work and accepted responses update the stored count.

Written by the indexing model from the issue text.

Description

Area: M3U P4 S
Describe the bug

#1378 stops an empty provider response from wiping channels. A short but non-empty one still does.

  • Problem: a response with ~440 streams where ~39,000 is normal parses cleanly and still runs stale marking, cleanup_streams and sync_auto_channels (apps/m3u/tasks.py:3914-3938, v0.32.0). Auto-synced channels and their EPG links are deleted, then recreated when the full list comes back.
  • Fix: before line 3914, compare streams seen with the last count that passed (kept in Redis). At 0 or under 80%, log an error and skip stale marking, cleanup and auto sync for that run; otherwise store the new count. If the check itself errors, skip.
  • Proven: 205 refreshes skipped over ten weeks, each a real partial response from the provider, with no channels lost.
How can we recreate this bug?
  • Reproduce: Auto Channel Sync on, serve the account ~1% of its streams for one refresh (mock or proxy), and the synced channels are gone.
Dispatcharr Version

v0.32.0

Docker Version

29.2.1

What's in your Docker Compose file?

Stock docker/docker-compose.aio.yml

Client Information

TiviMate (Android) over XC

Dominant language
Python
Stars
4.2k
Forks
324
Avg merge
1d 20h
Merged PRs (30d)
29

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Dispatcharr/Dispatcharr

All issues in Dispatcharr/Dispatcharr

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.