func (w *Watcher) SetEnabled(enabled bool) error {
	w.l.Lock()
	defer w.l.Unlock()

	wasEnabled := w.enabled
	w.enabled = enabled

	// Flush the state to create the necessary objects
	w.flush()

	// If we are starting now, launch the watch daemon
	if enabled && !wasEnabled {
		go w.watchDeployments(w.ctx)
	}

	return nil
}
// SetEnabled is used to control if the watcher is enabled. The watcher
// should only be enabled on the active leader.
SetEnabled is used to control if the watcher is enabled. The watcher
should only be enabled on the active leader.
// SetEnabled is used to control if the watcher is enabled . The watcher // should only be enabled on the active leader .
func (w *Watcher) SetEnabled(enabled bool) error {
	w.l.Lock()
	defer w.l.Unlock()
	wasEnabled := w.enabled
	w.enabled = enabled
	w.flush()
	if enabled && !wasEnabled {
		go w.watchDeployments(w.ctx)
	}
	return nil
}
func ( w * Watcher ) SetEnabled ( enabled bool ) error { w . l . Lock ( ) defer w . l . Unlock ( ) wasEnabled := w . enabled w . enabled = enabled w . flush ( ) if enabled && ! wasEnabled { go w . watchDeployments ( w . ctx ) } return nil }
SetEnabled is used to control if the watcher is enabled.
SetEnabled is used to control if the watcher is enabled .
// Flush the state to create the necessary objects // If we are starting now, launch the watch daemon