feat: 配置优化梳理

This commit is contained in:
tbphp
2025-07-11 21:23:56 +08:00
parent 1368792aa0
commit f655de3cda
20 changed files with 485 additions and 553 deletions

View File

@@ -47,7 +47,12 @@ func (gm *GroupManager) Initialize() error {
g := *group
g.EffectiveConfig = gm.settingsManager.GetEffectiveConfig(g.Config)
groupMap[g.Name] = &g
logrus.WithFields(logrus.Fields{
"group_name": g.Name,
"effective_config": g.EffectiveConfig,
}).Debug("Loaded group with effective config")
}
return groupMap, nil
}

View File

@@ -66,7 +66,7 @@ func (s *KeyCronService) runLoop() {
select {
case <-ticker.C:
if s.LeaderService.IsLeader() {
logrus.Info("KeyCronService: Running as leader, submitting validation jobs.")
logrus.Debug("KeyCronService: Running as leader, submitting validation jobs.")
s.submitValidationJobs()
} else {
logrus.Debug("KeyCronService: Not the leader. Standing by.")
@@ -130,7 +130,9 @@ func (s *KeyCronService) submitValidationJobs() {
s.updateGroupTimestamps(groupsToUpdateTimestamp, validationStartTime)
}
logrus.Infof("KeyCronService: Submitted %d keys for validation across %d groups.", total, len(groupsToUpdateTimestamp))
if total > 0 {
logrus.Infof("KeyCronService: Submitted %d keys for validation across %d groups.", total, len(groupsToUpdateTimestamp))
}
}
func (s *KeyCronService) updateGroupTimestamps(groups map[uint]*models.Group, validationStartTime time.Time) {

View File

@@ -52,8 +52,7 @@ func (s *KeyManualValidationService) StartValidationTask(group *models.Group) (*
return nil, fmt.Errorf("no keys to validate in group %s", group.Name)
}
timeoutMinutes := s.SettingsManager.GetInt("key_validation_task_timeout_minutes", 60)
timeout := time.Duration(timeoutMinutes) * time.Minute
timeout := 30 * time.Minute
taskStatus, err := s.TaskService.StartTask(group.Name, len(keys), timeout)
if err != nil {

View File

@@ -298,8 +298,6 @@ func (s *KeyService) TestMultipleKeys(ctx context.Context, group *models.Group,
chunk := keysToTest[i:end]
results, err := s.KeyValidator.TestMultipleKeys(ctx, group, chunk)
if err != nil {
// If one chunk fails, we might want to stop or collect partial results.
// For now, let's stop and return the error.
return nil, err
}
allResults = append(allResults, results...)