From 7c77efec1de321e5cb6b1e7ad38b0f3ba2efb8fe Mon Sep 17 00:00:00 2001 From: James Shubin Date: Fri, 2 May 2025 00:01:46 -0400 Subject: [PATCH] engine: resources: Cleanup this old code This is equivalent and cleaner. --- engine/resources/kv.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/engine/resources/kv.go b/engine/resources/kv.go index bfe4e4b1..5c9dd6c5 100644 --- a/engine/resources/kv.go +++ b/engine/resources/kv.go @@ -209,10 +209,8 @@ func (obj *KVRes) Watch(ctx context.Context) error { obj.init.Running() // when started, notify engine that we're running - var send = false // send event? for { select { - // NOTE: this part is very similar to the file resource code case err, ok := <-ch: if !ok { // channel shutdown return nil @@ -223,17 +221,12 @@ func (obj *KVRes) Watch(ctx context.Context) error { if obj.init.Debug { obj.init.Logf("event!") } - send = true case <-ctx.Done(): // closed by the engine to signal shutdown return nil } - // do all our event sending all together to avoid duplicate msgs - if send { - send = false - obj.init.Event() // notify engine of an event (this can block) - } + obj.init.Event() // notify engine of an event (this can block) } }