StopWatch stops watching for configuration changes and removes the associated watcher
(ctx context.Context)
| 223 | |
| 224 | // StopWatch stops watching for configuration changes and removes the associated watcher |
| 225 | func (l *Loader[T]) StopWatch(ctx context.Context) (bool, error) { |
| 226 | l.mutex.Lock() |
| 227 | defer l.mutex.Unlock() |
| 228 | |
| 229 | if l.watcherName == "" { |
| 230 | return false, gerror.New("No watcher name specified") |
| 231 | } |
| 232 | adapter := l.config.GetAdapter() |
| 233 | if watcherAdapter, ok := adapter.(WatcherAdapter); ok { |
| 234 | watcherAdapter.RemoveWatcher(l.watcherName) |
| 235 | l.watcherName = "" |
| 236 | return true, nil |
| 237 | } |
| 238 | return false, gerror.New("Watcher adapter not found") |
| 239 | } |
| 240 | |
| 241 | // IsWatching returns true if the loader is currently watching for configuration changes |
| 242 | func (l *Loader[T]) IsWatching() bool { |