resources: Remove SetWatching/IsWatching code from Watch
This removes some boilerplate from the Watch methods which can be baked into the engine instead. This code should be checked for races and locks to make sure we only start resources when it makes sense to.
This commit is contained in:
@@ -74,11 +74,6 @@ func (obj *TimerRes) newTicker() *time.Ticker {
|
||||
|
||||
// Watch is the primary listener for this resource and it outputs events.
|
||||
func (obj *TimerRes) Watch(processChan chan event.Event) error {
|
||||
if obj.IsWatching() {
|
||||
return nil
|
||||
}
|
||||
obj.SetWatching(true)
|
||||
defer obj.SetWatching(false)
|
||||
cuid := obj.Converger() // get the converger uid used to report status
|
||||
|
||||
// create a time.Ticker for the given interval
|
||||
|
||||
Reference in New Issue
Block a user