engine: resources: Simplify the Watch loop
I had some legacy unnecessary boolean for sending everywhere. Not sure why I never re-read it, it's so easy to just copy and paste and carry on.
This commit is contained in:
@@ -526,7 +526,6 @@ func (obj *HTTPServerRes) Watch(ctx context.Context) error {
|
||||
startupChan := make(chan struct{})
|
||||
close(startupChan) // send one initial signal
|
||||
|
||||
var send = false // send event?
|
||||
for {
|
||||
if obj.init.Debug {
|
||||
obj.init.Logf("Looping...")
|
||||
@@ -535,7 +534,6 @@ func (obj *HTTPServerRes) Watch(ctx context.Context) error {
|
||||
select {
|
||||
case <-startupChan:
|
||||
startupChan = nil
|
||||
send = true
|
||||
|
||||
case err, ok := <-multiplexedChan:
|
||||
if !ok { // shouldn't happen
|
||||
@@ -545,7 +543,6 @@ func (obj *HTTPServerRes) Watch(ctx context.Context) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
send = true
|
||||
|
||||
case <-closeSignal: // something shut us down early
|
||||
return closeError
|
||||
@@ -554,11 +551,7 @@ func (obj *HTTPServerRes) Watch(ctx context.Context) error {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user