Fix YouTube hammering, sync rate limiting, and Following load time

Sync throttling:
- sync-all now skips channels crawled within the last 6 hours (prevents
  re-scraping 1266 channels on every button press)
- Channels are queued into a single _index_channels_batch task that runs
  with 1.5s delay between each yt-dlp call instead of firing 1266
  background tasks simultaneously
- Startup enrich task reduced from 10 to 3 videos (3 yt-dlp calls on
  each container restart)
- Enrich task adds 2s sleep between metadata fetches

SQLite stability:
- busy_timeout=5000 prevents SQLITE_BUSY errors under concurrent load
- synchronous=NORMAL speeds up writes without data loss risk (safe with WAL)

Following page:
- staleTime: 60s on channels query so cached data is reused immediately
  on revisit; gcTime keeps it in memory for 5 min

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mattias Tall
2026-05-26 16:00:37 +02:00
parent 0d6dd94029
commit 1cd8645957
4 changed files with 23 additions and 6 deletions

View File

@@ -579,6 +579,8 @@ export default function Following() {
const { data: channels = [], isLoading: loadingChannels } = useQuery({
queryKey: ["channels"],
queryFn: () => getChannels().then((r) => r.data),
staleTime: 60_000,
gcTime: 5 * 60_000,
});
const { data: appSettings } = useQuery({