mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 07:15:47 +00:00
fix(analysis): native library backfill coordinator for advanced strategy (#881)
* feat(analysis): native library backfill coordinator for advanced strategy Move advanced analytics scheduling from the webview loop into a Rust background worker (configure + spawn_blocking batch/enqueue), matching cover backfill. Scan hash+BPM gap tracks instead of the full library; suppress low-priority analysis UI events; limit loudness refresh IPC to the playback window. * fix(analysis): flat backfill configure IPC and restore probe track-perf Use flattened Tauri args like cover backfill so release/prod invoke works; keep emitting analysis:track-perf for library low-priority work so Performance Probe tpm/last-track stats update while waveform/enrichment UI events stay suppressed. * chore(analysis): fix clippy and drop duplicate TS backfill policy Allow too_many_arguments on library_analysis_backfill_configure for CI; remove unused frontend batch API and TS watermark helpers now owned in Rust; clarify analysis_emits_ui_events comment for low-priority track-perf. * docs: CHANGELOG and credits for PR #881 native analysis backfill
This commit is contained in:
+18
-21
@@ -28,12 +28,6 @@ export interface AnalysisPipelineQueueStatsDto {
|
||||
cpuDecodeActiveLow: number;
|
||||
}
|
||||
|
||||
export interface LibraryAnalysisBackfillBatchDto {
|
||||
trackIds: string[];
|
||||
nextCursor: string | null;
|
||||
exhausted: boolean;
|
||||
}
|
||||
|
||||
export interface LibraryAnalysisProgressDto {
|
||||
totalTracks: number;
|
||||
pendingTracks: number;
|
||||
@@ -52,8 +46,6 @@ export interface AnalysisDeleteServerReportDto {
|
||||
loudness: number;
|
||||
}
|
||||
|
||||
export const LIBRARY_ANALYSIS_BACKFILL_BATCH_SIZE = 20;
|
||||
|
||||
function serverIndexKeyForId(serverId: string): string {
|
||||
const server = useAuthStore.getState().servers.find(s => s.id === serverId);
|
||||
if (!server) return serverId;
|
||||
@@ -68,19 +60,6 @@ export function analysisGetPipelineQueueStats(): Promise<AnalysisPipelineQueueSt
|
||||
return invoke<AnalysisPipelineQueueStatsDto>('analysis_get_pipeline_queue_stats');
|
||||
}
|
||||
|
||||
export function libraryAnalysisBackfillBatch(
|
||||
serverId: string,
|
||||
cursor?: string | null,
|
||||
limit = LIBRARY_ANALYSIS_BACKFILL_BATCH_SIZE,
|
||||
): Promise<LibraryAnalysisBackfillBatchDto> {
|
||||
const indexKey = serverIndexKeyForId(serverId);
|
||||
return invoke<LibraryAnalysisBackfillBatchDto>('library_analysis_backfill_batch', {
|
||||
serverId: indexKey,
|
||||
cursor: cursor ?? null,
|
||||
limit,
|
||||
});
|
||||
}
|
||||
|
||||
export function libraryAnalysisProgress(
|
||||
serverId: string,
|
||||
): Promise<LibraryAnalysisProgressDto> {
|
||||
@@ -157,3 +136,21 @@ export function analysisEnqueueSeedFromUrl(
|
||||
const indexKey = serverIndexKeyForId(serverId);
|
||||
return invoke('analysis_enqueue_seed_from_url', { trackId, url, serverId: indexKey, priority });
|
||||
}
|
||||
|
||||
export type LibraryAnalysisBackfillConfigureArgs = {
|
||||
enabled: boolean;
|
||||
serverIndexKey: string;
|
||||
libraryServerId: string;
|
||||
serverUrl: string;
|
||||
username: string;
|
||||
password: string;
|
||||
workers: number;
|
||||
};
|
||||
|
||||
/** Start/stop native library analysis backfill (advanced strategy only). */
|
||||
export function libraryAnalysisBackfillConfigure(
|
||||
args: LibraryAnalysisBackfillConfigureArgs,
|
||||
): Promise<void> {
|
||||
// Flat payload — same as `library_cover_backfill_configure` (not `{ args: … }`).
|
||||
return invoke('library_analysis_backfill_configure', args);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user