Skip to content

Commit 9f01898

Browse files
committed
Fix error with cleaning up the maps used by processes
1 parent 4e27b86 commit 9f01898

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

apps/matching-service/handlers/websocket.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,17 @@ func waitForResult(ws *websocket.Conn, ctx, timeoutCtx, matchCtx context.Context
170170
// Notify the user about the match
171171
notifyMatches(result.User, result)
172172

173-
// NOTE: user and other user are already cleaned up in a separate matching algorithm process
174-
// so no clean up is required here.
173+
// cleaning up from the global maps used still required
174+
if _, exists := matchContexts[username]; exists {
175+
delete(matchContexts, username)
176+
}
177+
if _, exists := activeConnections[username]; exists {
178+
delete(activeConnections, username)
179+
}
180+
if _, exists := matchFoundChannels[username]; exists {
181+
delete(matchFoundChannels, username)
182+
}
183+
175184
return
176185
}
177186
}

0 commit comments

Comments
 (0)