diff --git a/apps/matching-service/handlers/websocket.go b/apps/matching-service/handlers/websocket.go index 7727654648..7432ab3a8e 100644 --- a/apps/matching-service/handlers/websocket.go +++ b/apps/matching-service/handlers/websocket.go @@ -170,8 +170,17 @@ func waitForResult(ws *websocket.Conn, ctx, timeoutCtx, matchCtx context.Context // Notify the user about the match notifyMatches(result.User, result) - // NOTE: user and other user are already cleaned up in a separate matching algorithm process - // so no clean up is required here. + // cleaning up from the global maps used still required + if _, exists := matchContexts[username]; exists { + delete(matchContexts, username) + } + if _, exists := activeConnections[username]; exists { + delete(activeConnections, username) + } + if _, exists := matchFoundChannels[username]; exists { + delete(matchFoundChannels, username) + } + return } } diff --git a/apps/matching-service/tests/websocket-test.html b/apps/matching-service/tests/websocket-test.html index 86d2be302c..4cba225c44 100644 --- a/apps/matching-service/tests/websocket-test.html +++ b/apps/matching-service/tests/websocket-test.html @@ -6,12 +6,19 @@ Matching service: websocket test -

Status: no matching yet

- - -

+

Status (Conn 1): no matching yet

+ + +

+ +

Status (Conn 2): no matching yet

+ + +

+