[overlays] Fix: Do not spam logs with errors when overlay reloaded

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2023-12-24 14:28:07 +01:00
parent eb02858280
commit fa9f5591f6
Signed by: luzifer
SSH Key Fingerprint: SHA256:/xtE5lCgiRDQr8SLxHMS92ZBlACmATUmF1crK16Ks4E

View File

@ -315,10 +315,18 @@ func handleSocketSubscription(w http.ResponseWriter, r *http.Request) {
return
case err := <-errC:
if err != nil {
logger.WithError(err).Error("Message processing caused error")
var cErr *websocket.CloseError
switch {
case err == nil:
// We use nil-error to close the connection
case errors.As(err, &cErr) && websocket.IsCloseError(cErr, websocket.CloseNormalClosure, websocket.CloseGoingAway):
// We don't need to log when the remote closes the websocket gracefully
default:
logger.WithError(err).Error("message processing caused error")
}
return // We use nil-error to close the connection
return // All errors need to quit this function
case msg := <-sendMsgC:
if !isAuthorized {