Popular: write Phase 1 immediately, enrich view_count in background
Previously the task waited for all 30 parallel metadata fetches before writing anything to the DB (~30s). Now Phase 1 (flat-playlist IDs + basic info) commits to channel_popular_videos immediately (~5s), so the tab populates fast. Phase 2 (view_count + dates) runs in a daemon thread while the user is already browsing. Also: catch table-not-found errors in the sort=popular query so a cold server returns [] instead of 500. Frontend refetch wait 35s→8s to match the faster Phase 1 commit time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -117,7 +117,7 @@ export default function ChannelPage() {
|
||||
|
||||
const popularMut = useMutation({
|
||||
mutationFn: () => fetchPopularVideos(id),
|
||||
onSuccess: () => scheduleRefetch(35000),
|
||||
onSuccess: () => scheduleRefetch(8000),
|
||||
});
|
||||
|
||||
const deepSearchMut = useMutation({
|
||||
|
||||
Reference in New Issue
Block a user