perf(m3u): stop cancelled refresh workers (#1268)

This commit is contained in:
4gray authored and GitHub committed 2026-07-26 09:25:51 +02:00
1 parent 7e8c2ccce1
commit f147d4fe37
28 files changed
+3205 -89

No files matched your search

@@ -21,6 +21,7 @@ import {
XtreamBackupRecentlyViewedItem,
} from './playlist-backup.interface';
import {
PlaylistRefreshCancelledResult,
PlaylistRefreshEvent,
PlaylistRefreshPayload,
} from './playlist-refresh.interface';
@@ -671,7 +672,9 @@ export interface ElectronBridgeApi {
url: string,
method?: 'GET' | 'HEAD'
) => Promise<ElectronBridgeXtreamProbeResult>;
refreshPlaylist: (payload: PlaylistRefreshPayload) => Promise<Playlist>;
refreshPlaylist: (
payload: PlaylistRefreshPayload
) => Promise<Playlist | PlaylistRefreshCancelledResult>;
cancelPlaylistRefresh: (
operationId: string
) => Promise<ElectronBridgeResult>;
@@ -27,3 +27,25 @@ export interface PlaylistRefreshPayload {
url?: string;
trustedInsecureTlsHosts?: string[];
}
export const PLAYLIST_REFRESH_CANCELLED_RESULT_TYPE =
'playlist-refresh-cancelled' as const;
export interface PlaylistRefreshCancelledResult {
operationId: string;
type: typeof PLAYLIST_REFRESH_CANCELLED_RESULT_TYPE;
}
export function isPlaylistRefreshCancelledResult(
value: unknown
): value is PlaylistRefreshCancelledResult {
if (!value || typeof value !== 'object') {
return false;
}
const candidate = value as Record<string, unknown>;
return (
candidate['type'] === PLAYLIST_REFRESH_CANCELLED_RESULT_TYPE &&
typeof candidate['operationId'] === 'string'
);
}