| 418 | } |
| 419 | |
| 420 | func (w *Watcher) persistAuthAsync(message string, paths ...string) { |
| 421 | if w == nil || w.storePersister == nil { |
| 422 | return |
| 423 | } |
| 424 | filtered := make([]string, 0, len(paths)) |
| 425 | for _, p := range paths { |
| 426 | if trimmed := strings.TrimSpace(p); trimmed != "" { |
| 427 | filtered = append(filtered, trimmed) |
| 428 | } |
| 429 | } |
| 430 | if len(filtered) == 0 { |
| 431 | return |
| 432 | } |
| 433 | go func() { |
| 434 | ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) |
| 435 | defer cancel() |
| 436 | if err := w.storePersister.PersistAuthFiles(ctx, message, filtered...); err != nil { |
| 437 | log.Errorf("failed to persist auth changes: %v", err) |
| 438 | } |
| 439 | }() |
| 440 | } |
| 441 | |
| 442 | func (w *Watcher) stopServerUpdateTimer() { |
| 443 | w.serverUpdateMu.Lock() |