Skip to content

Commit

Permalink
Added sleep to make sure that the cancelled context log is shown
Browse files Browse the repository at this point in the history
  • Loading branch information
kostasbalampekos committed Apr 5, 2024
1 parent 1ca874f commit 21c1f56
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pkg/mqtt/websocket/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func (p Proxy) handle() http.Handler {
go func() {
defer cancel() // Cancel the context when the goroutine finishes
p.pass(ctx, cconn)
time.Sleep(5 * time.Second)
select {
case <-ctx.Done():
p.logger.Info("Context cancelled at the end of goroutine", slog.Any("error", ctx.Err()))
Expand Down

0 comments on commit 21c1f56

Please sign in to comment.