Close SSE connection on write error

This commit is contained in:
Deluan 2023-04-02 18:08:10 -04:00
parent 458017b112
commit d6dd0aaae7
1 changed files with 2 additions and 1 deletions

View File

@ -158,7 +158,8 @@ func (b *broker) ServeHTTP(w http.ResponseWriter, r *http.Request) {
log.Trace(ctx, "Sending event to client", "event", *event, "client", c.String())
err := writeEvent(ctx, w, *event, writeTimeOut)
if err != nil {
log.Debug(ctx, "Error sending event to client", "event", *event, "client", c.String(), err)
log.Debug(ctx, "Error sending event to client. Closing connection", "event", *event, "client", c.String(), err)
return
}
}
}