Skip to content

Commit

Permalink
add message to recover func
Browse files Browse the repository at this point in the history
  • Loading branch information
illia-malachyn committed Feb 24, 2025
1 parent 9b501e9 commit f8d1af9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions engine/access/rest/websockets/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ func (c *Controller) configureKeepalive() error {
// and avoid timeouts.
func (c *Controller) keepalive(ctx context.Context) error {
defer func() {
// gracefully handle panics from github.com/gorilla/websocket
if r := recover(); r != nil {
c.logger.Warn().Interface("recovered_context", r).Msg("keepalive routine recovered from panic")
}
Expand Down Expand Up @@ -253,6 +254,7 @@ func (c *Controller) keepalive(ctx context.Context) error {
// the connection will be closed.
func (c *Controller) writeMessages(ctx context.Context) error {
defer func() {
// gracefully handle panics from github.com/gorilla/websocket
if r := recover(); r != nil {
c.logger.Warn().Interface("recovered_context", r).Msg("writer routine recovered from panic")
}
Expand Down Expand Up @@ -321,6 +323,7 @@ func (c *Controller) inactivityTickerPeriod() time.Duration {
// validates each message, and processes it based on the message type.
func (c *Controller) readMessages(ctx context.Context) error {
defer func() {
// gracefully handle panics from github.com/gorilla/websocket
if r := recover(); r != nil {
c.logger.Warn().Interface("recovered_context", r).Msg("reader routine recovered from panic")
}
Expand Down

0 comments on commit f8d1af9

Please sign in to comment.