Skip to content

Commit

Permalink
Update context so cleaning up after cancellation works
Browse files Browse the repository at this point in the history
  • Loading branch information
bensohh committed Oct 18, 2024
1 parent 021eade commit 58f9b3b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/matching-service/handlers/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ func waitForResult(ws *websocket.Conn, ctx, timeoutCtx, matchCtx context.Context
case <-ctx.Done():
log.Println("Matching cancelled")
// Cleanup Redis
processes.CleanUpUser(processes.GetRedisClient(), username, ctx)
processes.CleanUpUser(processes.GetRedisClient(), username, context.Background())
return
case <-timeoutCtx.Done():
log.Println("Connection timed out")
// Cleanup Redis
processes.CleanUpUser(processes.GetRedisClient(), username, ctx)
processes.CleanUpUser(processes.GetRedisClient(), username, context.Background())
sendTimeoutResponse(ws)
return
case <-matchCtx.Done():
Expand Down

0 comments on commit 58f9b3b

Please sign in to comment.