缓解io压力

This commit is contained in:
2026-09-02 16:14:27 +08:00
parent 395e5fb47c
commit dbfeeee253
17 changed files with 181 additions and 144 deletions

View File

@@ -169,7 +169,9 @@ type GatewayConfig struct {
type WorkerConfig struct {
Role string `mapstructure:"role"` // Worker 运行角色all、leader、consumer
InstanceName string `mapstructure:"instance_name"` // Worker 实例名称,用于多实例日志区分
PollingTotalMaxConcurrency int `mapstructure:"polling_total_max_concurrency"` // 全部轮询总并发上限
AuditRetentionCleanupEnabled bool `mapstructure:"audit_retention_cleanup_enabled"` // 是否启用审计日志物理清理
AuditArchiveTasksEnabled bool `mapstructure:"audit_archive_tasks_enabled"` // 是否启用审计归档与日留存任务
}
// ApprovalConfig 审批新旧入口切换配置。
@@ -382,6 +384,10 @@ func (c *Config) Validate() error {
constants.WorkerRoleLeader: true,
constants.WorkerRoleConsumer: true,
}
if c.Worker.PollingTotalMaxConcurrency < 1 || c.Worker.PollingTotalMaxConcurrency > constants.PollingMaxConcurrencyLimit {
return fmt.Errorf("invalid configuration: worker.polling_total_max_concurrency: must be 1-%d (current value: %d)", constants.PollingMaxConcurrencyLimit, c.Worker.PollingTotalMaxConcurrency)
}
if !validWorkerRoles[c.Worker.Role] {
return fmt.Errorf(
"invalid configuration: worker.role: invalid worker role (current value: %s, expected: %s, %s, %s)",

View File

@@ -143,8 +143,11 @@ polling_auto_trigger:
worker:
role: "all"
instance_name: ""
polling_total_max_concurrency: 100
# 日留存只读演练验收通过前必须保持关闭
audit_retention_cleanup_enabled: false
# 审计归档、Integration 归档与日留存默认关闭,低峰期按单日推进
audit_archive_tasks_enabled: false
# 审批新旧入口切换配置
approval:

View File

@@ -135,7 +135,9 @@ func bindEnvVariables(v *viper.Viper) {
"polling_auto_trigger.auto_trigger_system_user_id",
"worker.role",
"worker.instance_name",
"worker.polling_total_max_concurrency",
"worker.audit_retention_cleanup_enabled",
"worker.audit_archive_tasks_enabled",
"approval.legacy_refund_manual_enabled",
"approval.legacy_offline_recharge_pay_enabled",
"wecom.base_url",