fix: 代码修复

This commit is contained in:
tbphp
2025-07-05 17:26:16 +08:00
parent c40ee7cb5b
commit 8f2a0c1afc
2 changed files with 6 additions and 9 deletions

View File

@@ -149,8 +149,8 @@ func (s *KeyCronService) worker(ctx context.Context, wg *sync.WaitGroup, group *
for key := range jobs {
isValid, validationErr := s.Validator.ValidateSingleKey(ctx, &key, group)
newStatus := key.Status
newErrorReason := key.ErrorReason
var newStatus string
var newErrorReason string
statusChanged := false
if validationErr != nil {
@@ -161,11 +161,8 @@ func (s *KeyCronService) worker(ctx context.Context, wg *sync.WaitGroup, group *
// Validation succeeded
if isValid {
newStatus = "active"
newErrorReason = "" // Clear reason on success
newErrorReason = ""
} else {
// This case might happen if the key is valid but has no quota, etc.
// The error would be in validationErr, so this branch is less likely.
// We still mark it as inactive but without a specific error from our side.
newStatus = "inactive"
newErrorReason = "Validation returned false without a specific error."
}