Dashboard shows 0 episodes - central database not synced with per-feed databases #57

Closed
opened 2026-01-18 22:19:08 +00:00 by joezombie · 0 comments
joezombie commented 2026-01-18 22:19:08 +00:00 (Migrated from github.com)

Description

The Dashboard shows 0 episodes even when there are episodes in the RSS feed. The Feeds list also shows 0 episodes for all feeds.

Root Cause

There are two separate database systems that aren't kept in sync:

  1. Per-feed databases ({feed_directory}/podcast.db)

    • Used by: PodcastFeedService (RSS feed generation)
    • Contains actual episode data
  2. Central database (/data/castr.db)

    • Used by: Dashboard UI
    • Episodes table is empty or out of sync

The migration from per-feed to central database only runs ONCE at startup when the central database has no feeds. After initial migration, new episodes are never synced.

Affected Code

Dashboard episode counting (uses central DB):

// Dashboard.razor:177-181
foreach (var feed in feeds)
{
    var episodes = await Database.GetEpisodesAsync(feed.Id);  // Central DB
    _episodeCount += episodes.Count;
}

RSS feed generation (uses per-feed DB):

// PodcastFeedService.cs:230
var dbEpisodes = await _database.GetEpisodesAsync(feedName);  // Per-feed DB

Solution Options

Option 1: Sync on startup (quick fix)

Add periodic sync from per-feed databases to central database:

// In Program.cs after migration check
foreach (var feed in existingFeeds)
{
    await centralDatabase.SyncFromPerFeedDatabaseAsync(feed);
}

Option 2: Update PodcastFeedService to use central database

Modify PodcastFeedService to use ICentralDatabaseService instead of IPodcastDatabaseService.

Option 3: Dual-write to both databases

Have PlaylistWatcherService write to both databases.

Acceptance Criteria

  • Dashboard shows correct episode count
  • Feed list shows correct episode count per feed
  • Episode list page shows all episodes
  • Episode counts remain accurate after new episodes are added
## Description The Dashboard shows 0 episodes even when there are episodes in the RSS feed. The Feeds list also shows 0 episodes for all feeds. ## Root Cause There are two separate database systems that aren't kept in sync: 1. **Per-feed databases** (`{feed_directory}/podcast.db`) - Used by: `PodcastFeedService` (RSS feed generation) - Contains actual episode data 2. **Central database** (`/data/castr.db`) - Used by: Dashboard UI - Episodes table is empty or out of sync The migration from per-feed to central database only runs ONCE at startup when the central database has no feeds. After initial migration, new episodes are never synced. ## Affected Code **Dashboard episode counting (uses central DB):** ```csharp // Dashboard.razor:177-181 foreach (var feed in feeds) { var episodes = await Database.GetEpisodesAsync(feed.Id); // Central DB _episodeCount += episodes.Count; } ``` **RSS feed generation (uses per-feed DB):** ```csharp // PodcastFeedService.cs:230 var dbEpisodes = await _database.GetEpisodesAsync(feedName); // Per-feed DB ``` ## Solution Options ### Option 1: Sync on startup (quick fix) Add periodic sync from per-feed databases to central database: ```csharp // In Program.cs after migration check foreach (var feed in existingFeeds) { await centralDatabase.SyncFromPerFeedDatabaseAsync(feed); } ``` ### Option 2: Update PodcastFeedService to use central database Modify `PodcastFeedService` to use `ICentralDatabaseService` instead of `IPodcastDatabaseService`. ### Option 3: Dual-write to both databases Have `PlaylistWatcherService` write to both databases. ## Acceptance Criteria - [ ] Dashboard shows correct episode count - [ ] Feed list shows correct episode count per feed - [ ] Episode list page shows all episodes - [ ] Episode counts remain accurate after new episodes are added
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
joezombie/castr#57
No description provided.