시작 시 메타 백필 + 백그라운드 처리 진행 표시(상태바)
- 메타 백필: 이전 스캔이 중단돼 meta_state=0으로 남은 파일을 시작 시 (전체 재스캔 없이) 저우선순위로 이어서 분석. 썸네일 백필(enqueue_pending)과 짝. - pending_counts 커맨드 + 상태바 표시: "썸네일 생성 중 N / 메타 분석 중 M". thumbs-ready·library-changed·시작 시 트리거하고, 남은 작업이 있으면 2초 폴링, 0이 되면 자동으로 숨김. 검증: 영상 200개 스캔 중 상태바가 200→0으로 감소 후 사라짐. 메타 도중 강제 종료 후 재실행 시 재스캔 없이(scanning=false) 메타/썸네일 백필만 재개됨. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+10
-3
@@ -9,16 +9,23 @@ import { MoveDialog } from "./features/fileops/MoveDialog";
|
||||
import { DedupePanel } from "./features/dedupe/DedupePanel";
|
||||
import { RemoteDialog } from "./features/sources/RemoteDialog";
|
||||
import { onLibraryChanged, onThumbsReady, type UnlistenFn } from "./ipc/commands";
|
||||
import { bumpThumbVersions, loadAppInfo, refreshSnapshot } from "./state/store";
|
||||
import { bumpThumbVersions, loadAppInfo, refreshPendingCounts, refreshSnapshot } from "./state/store";
|
||||
|
||||
const App: Component = () => {
|
||||
onMount(() => {
|
||||
void loadAppInfo();
|
||||
void refreshSnapshot();
|
||||
refreshPendingCounts();
|
||||
|
||||
const unlisteners: Promise<UnlistenFn>[] = [
|
||||
onThumbsReady((ids) => bumpThumbVersions(ids)),
|
||||
onLibraryChanged(() => onLibraryChangedRefresh()),
|
||||
onThumbsReady((ids) => {
|
||||
bumpThumbVersions(ids);
|
||||
refreshPendingCounts();
|
||||
}),
|
||||
onLibraryChanged(() => {
|
||||
onLibraryChangedRefresh();
|
||||
refreshPendingCounts();
|
||||
}),
|
||||
];
|
||||
onCleanup(() => {
|
||||
for (const u of unlisteners) void u.then((f) => f());
|
||||
|
||||
@@ -48,6 +48,8 @@ export const ko = {
|
||||
dataDir: "데이터 위치",
|
||||
portable: "포터블 모드",
|
||||
installed: "일반 모드",
|
||||
thumbPending: (n: number) => `썸네일 생성 중 ${n.toLocaleString("ko-KR")}개`,
|
||||
metaPending: (n: number) => `메타 분석 중 ${n.toLocaleString("ko-KR")}개`,
|
||||
},
|
||||
search: {
|
||||
placeholder: "파일명 검색…",
|
||||
|
||||
@@ -49,6 +49,11 @@ export interface ScanProgress {
|
||||
}
|
||||
|
||||
export const appInfo = () => invoke<AppInfo>("app_info");
|
||||
export interface PendingCounts {
|
||||
thumbs: number;
|
||||
meta: number;
|
||||
}
|
||||
export const pendingCounts = () => invoke<PendingCounts>("pending_counts");
|
||||
export const listSources = () => invoke<Source[]>("list_sources");
|
||||
export const addLocalSource = (path: string) =>
|
||||
invoke<Source>("add_local_source", { path });
|
||||
|
||||
+11
-1
@@ -1,6 +1,6 @@
|
||||
import { Show, type Component } from "solid-js";
|
||||
import { ko } from "../i18n/ko";
|
||||
import { info, scanProgress, selected, snapshot, statusMessage } from "../state/store";
|
||||
import { info, pending, scanProgress, selected, snapshot, statusMessage } from "../state/store";
|
||||
|
||||
export const StatusBar: Component = () => {
|
||||
return (
|
||||
@@ -25,6 +25,16 @@ export const StatusBar: Component = () => {
|
||||
</span>
|
||||
)}
|
||||
</Show>
|
||||
{/* 백그라운드 처리 진행 — 썸네일/메타 대기 수 (있을 때만) */}
|
||||
<Show when={pending().thumbs > 0 || pending().meta > 0}>
|
||||
<span class="flex items-center gap-1.5 text-[var(--text-muted)]">
|
||||
<span class="inline-block h-2.5 w-2.5 animate-spin rounded-full border border-[var(--text-muted)] border-t-transparent" />
|
||||
<Show when={pending().thumbs > 0}>{ko.statusBar.thumbPending(pending().thumbs)}</Show>
|
||||
<Show when={pending().meta > 0}>
|
||||
<span class="ml-1">{ko.statusBar.metaPending(pending().meta)}</span>
|
||||
</Show>
|
||||
</span>
|
||||
</Show>
|
||||
<Show when={info()}>
|
||||
{(i) => (
|
||||
<>
|
||||
|
||||
@@ -4,11 +4,13 @@ import { createStore, produce } from "solid-js/store";
|
||||
import {
|
||||
appInfo,
|
||||
folderSnapshot,
|
||||
pendingCounts as fetchPendingCounts,
|
||||
searchSnapshot,
|
||||
smartSnapshot,
|
||||
tagSnapshot,
|
||||
Snapshot,
|
||||
type AppInfo,
|
||||
type PendingCounts,
|
||||
type ScanProgress,
|
||||
} from "../ipc/commands";
|
||||
|
||||
@@ -134,6 +136,29 @@ export function updateScanProgress(p: ScanProgress): void {
|
||||
setScanProgress(p.done ? undefined : p);
|
||||
}
|
||||
|
||||
// ── 백그라운드 처리 진행(썸네일/메타 대기 수) ────────────
|
||||
const [pending, setPending] = createSignal<PendingCounts>({ thumbs: 0, meta: 0 });
|
||||
export { pending };
|
||||
|
||||
let pendingTimer: ReturnType<typeof setTimeout> | undefined;
|
||||
async function doRefreshPending(): Promise<void> {
|
||||
try {
|
||||
const c = await fetchPendingCounts();
|
||||
setPending(c);
|
||||
clearTimeout(pendingTimer);
|
||||
// 남은 작업이 있으면 계속 폴링(썸네일은 thumbs-ready로도 갱신되지만 메타는 이벤트가 없어 폴링 필요)
|
||||
if (c.thumbs > 0 || c.meta > 0) pendingTimer = setTimeout(() => void doRefreshPending(), 2000);
|
||||
} catch {
|
||||
/* 무시 */
|
||||
}
|
||||
}
|
||||
|
||||
/** 대기 수 갱신 트리거(디바운스). 시작·thumbs-ready·library-changed에서 호출. */
|
||||
export function refreshPendingCounts(): void {
|
||||
clearTimeout(pendingTimer);
|
||||
pendingTimer = setTimeout(() => void doRefreshPending(), 400);
|
||||
}
|
||||
|
||||
// ── 사이드바 새로고침 트리거 ─────────────────────────────
|
||||
const [sidebarVersion, setSidebarVersion] = createSignal(0);
|
||||
export { sidebarVersion };
|
||||
|
||||
Reference in New Issue
Block a user