fix: sync directory and trigger YouTube fetch on feed creation #71

Merged
joezombie merged 5 commits from fix/sync-on-feed-creation into main 2026-02-12 23:05:17 +00:00
joezombie commented 2026-02-12 22:24:29 +00:00 (Migrated from github.com)

Summary

  • Existing files not discovered: Creating a feed only inserted a DB row — SyncDirectoryAsync was never called, so files already in the directory didn't appear as episodes
  • YouTube fetch delayed: New YouTube-enabled feeds had to wait up to 60s for the next PlaylistWatcherService poll cycle with no way to trigger immediate processing
  • Adds IPlaylistWatcherTrigger (Channel-based) so the UI can wake the watcher immediately after feed creation

Error handling hardening (from code review)

  • FeedEdit.razor: SyncDirectoryAsync failure no longer shows misleading "Failed to save feed" — shows a warning instead since the feed was already saved
  • PlaylistWatcherService: Fixed CTS disposal race during shutdown by moving cleanup into finally block
  • PlaylistWatcherService: Isolated SyncAllFeedDirectoriesAsync failure so it can't abort the entire YouTube poll cycle
  • PlaylistWatcherService: Added OperationCanceledException filter to per-feed catch block (consistent with main loop)
  • PlaylistWatcherTrigger: Added feedName null/whitespace guard

Test plan

  • Create a feed pointing to a directory with existing MP3 files — verify episodes appear immediately
  • Create a YouTube-enabled feed — verify playlist fetch starts within seconds, not after 60s
  • Create a feed with no files and no YouTube — verify no errors
  • Verify existing feeds continue to poll on their normal intervals
  • Create a feed with an invalid directory path — verify feed is created with a warning, not an error

🤖 Generated with Claude Code

## Summary - **Existing files not discovered**: Creating a feed only inserted a DB row — `SyncDirectoryAsync` was never called, so files already in the directory didn't appear as episodes - **YouTube fetch delayed**: New YouTube-enabled feeds had to wait up to 60s for the next `PlaylistWatcherService` poll cycle with no way to trigger immediate processing - Adds `IPlaylistWatcherTrigger` (Channel-based) so the UI can wake the watcher immediately after feed creation ## Error handling hardening (from code review) - **FeedEdit.razor**: `SyncDirectoryAsync` failure no longer shows misleading "Failed to save feed" — shows a warning instead since the feed was already saved - **PlaylistWatcherService**: Fixed CTS disposal race during shutdown by moving cleanup into `finally` block - **PlaylistWatcherService**: Isolated `SyncAllFeedDirectoriesAsync` failure so it can't abort the entire YouTube poll cycle - **PlaylistWatcherService**: Added `OperationCanceledException` filter to per-feed catch block (consistent with main loop) - **PlaylistWatcherTrigger**: Added `feedName` null/whitespace guard ## Test plan - [ ] Create a feed pointing to a directory with existing MP3 files — verify episodes appear immediately - [ ] Create a YouTube-enabled feed — verify playlist fetch starts within seconds, not after 60s - [ ] Create a feed with no files and no YouTube — verify no errors - [ ] Verify existing feeds continue to poll on their normal intervals - [ ] Create a feed with an invalid directory path — verify feed is created with a warning, not an error 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No description provided.