fix: use updateProcessConcurrency to persist slider changes to config.yaml

- CleanerPage now uses updateProcessConcurrency instead of setProcessConcurrency
- This ensures slider changes are persisted to config.yaml via IPC
- Remove unused queryBatchSize and setProcessConcurrency from destructuring
This commit is contained in:
Misaka_Company
2026-03-17 10:57:24 +08:00
parent 103effcfca
commit b289fb9624
8 changed files with 99 additions and 52 deletions

View File

@@ -10,6 +10,7 @@ import type { UserType, ConnectionTestResult, SaveSettingsResult } from '../type
import { IPC_CHANNELS } from '../../shared/ipc-channels'
import { ValidationError } from '../types/errors'
import { withErrorHandling, type IpcResult } from './index'
import type { CleanerConfig } from '../types/config.schema'
const log = createLogger('SettingsHandler')
@@ -174,4 +175,26 @@ export function registerSettingsHandlers(): void {
}, 'settings:testDbConnection')
}
)
ipcMain.handle(IPC_CHANNELS.CONFIG_GET_CLEANER, async (): Promise<IpcResult<CleanerConfig>> => {
return withErrorHandling(async () => {
const configManager = ConfigManager.getInstance()
const config = configManager.getConfig()
return config.cleaner
}, 'config:getCleaner')
})
ipcMain.handle(
IPC_CHANNELS.CONFIG_UPDATE_CLEANER,
async (_event, updates: Partial<CleanerConfig>): Promise<IpcResult<CleanerConfig>> => {
return withErrorHandling(async () => {
const configManager = ConfigManager.getInstance()
const result = await configManager.updateConfig({ cleaner: updates as CleanerConfig })
if (!result.success) {
throw new Error(result.error)
}
return configManager.getConfig().cleaner
}, 'config:updateCleaner')
}
)
}

View File

@@ -81,6 +81,10 @@ const DEFAULT_CONFIG: FullConfig = {
enableCrud: false,
defaultManager: ''
},
cleaner: {
queryBatchSize: 100,
processConcurrency: 1
},
orderResolution: {
tableName: '',
productionIdField: '',

View File

@@ -97,6 +97,15 @@ export const validationConfigSchema = z.object({
defaultManager: z.string().default('')
})
/**
* 清理配置 Schema
*/
export const cleanerConfigSchema = z.object({
queryBatchSize: z.number().int().min(1).max(100).default(100),
processConcurrency: z.number().int().min(1).max(20).default(1)
})
export type CleanerConfig = z.infer<typeof cleanerConfigSchema>
/**
* 订单号解析配置 Schema
*/
@@ -131,6 +140,7 @@ export const fullConfigSchema = z.object({
paths: pathsConfigSchema,
extraction: extractionConfigSchema,
validation: validationConfigSchema,
cleaner: cleanerConfigSchema,
orderResolution: orderResolutionSchema,
logging: loggingConfigSchema
})