refactor(electron): remove redundant generateIncrementalSessions calls after incremental import

Session index is now built inside the shared incremental-importer, so the
explicit post-import worker.generateIncrementalSessions(sessionId) calls in
the Desktop layer were no-ops. Remove all four call sites.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
diguaandClaude Sonnet 4.6 committed 2026-06-25 21:45:16 +08:00
1 parent 467222b68e
commit 0f1ea43a11
3 files changed
-20

No files matched your search

-5
View File
@@ -129,11 +129,6 @@ export class WorkerImporter implements DataImporter {
const result = await worker.incrementalImport(sessionId, tempFile)
if (result.success) {
this.logger.info(`[Pull] Incremental OK: +${result.newMessageCount} messages`)
try {
await worker.generateIncrementalSessions(sessionId)
} catch {
/* ignore */
}
return { success: true, newMessageCount: result.newMessageCount, sessionId }
}
if (result.error === 'error.session_not_found' || result.error?.includes('no such table')) {
-10
View File
@@ -264,11 +264,6 @@ async function handleUnifiedImport(request: FastifyRequest, reply: FastifyReply,
const result = await worker.incrementalImport(sessionId, tempFile, undefined, importOptions)
if (result.success) {
try {
await worker.generateIncrementalSessions(sessionId)
} catch {
// non-blocking
}
notifySessionListChanged()
const responsePayload = successResponse({
sessionId,
@@ -390,11 +385,6 @@ async function handleLegacyImport(request: FastifyRequest, reply: FastifyReply,
const result = await worker.incrementalImport(sessionId, tempFile, undefined, importOptions)
if (result.success) {
try {
await worker.generateIncrementalSessions(sessionId)
} catch {
// non-blocking
}
notifySessionListChanged()
reply.send(
successResponse({
-5
View File
@@ -283,11 +283,6 @@ export function registerChatHandlers(ctx: IpcContext): void {
})
if (result.success) {
try {
await worker.generateIncrementalSessions(sessionId)
} catch (e) {
console.error('[IpcMain] Failed to incrementally generate session index:', e)
}
// 分析缓存按 DB 文件版本自动失效,无需手动清理
// 通知渲染进程刷新会话列表(与 API 路由的 notifySessionListChanged 保持一致)
win.webContents.send('api:importCompleted')