mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-13 20:56:19 -08:00
perf(recents): batch Xtream remove-recent-item into a single IPC call
Clearing all recents of a given content type fired N concurrent IPC calls, each opening its own implicit transaction in the recently_viewed table. For users with hundreds of recently-watched VOD/series rows this added real overhead even though the UI updates optimistically. Add a new DB_REMOVE_RECENT_ITEMS_BATCH path end-to-end: - removeRecentItemsBatch() Drizzle op: one transaction, one prepared statement reused per row - Wire through worker → IPC handler → preload → window.electron typings → DatabaseService - UnifiedRecentDataService.removeRecentItemsBatch() groups items by source. Xtream items go through the new batch IPC. M3U/Stalker items still go per-playlist because they update a JSON column on the playlist row, not the recently_viewed table — but they now run in parallel with the Xtream batch via a single Promise.all. - Single call site updated: unified-collection-page "Clear all of type" confirmation handler. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Entire-Checkpoint: 4bfb62f988b7
This commit is contained in:
1 parent
21fe51e73b
commit
39ddaa2f9c
12 files changed
+111
-5
No files matched your search
@@ -838,6 +838,21 @@ export class DatabaseService {
|
||||
}
|
||||
}
|
||||
|
||||
async removeRecentItemsBatch(
|
||||
items: { contentId: number; playlistId: string }[]
|
||||
): Promise<boolean> {
|
||||
if (items.length === 0) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
await window.electron.dbRemoveRecentItemsBatch(items);
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error('Error removing recent items batch:', error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content by xtream ID
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user