Skip to content

Commit 38c0141

Browse files
committed
bug/match-logic: Fix matching clause bug
Signed-off-by: SeeuSim <[email protected]>
1 parent 1f95c75 commit 38c0141

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

backend/matching/src/workers/matcher.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ async function match() {
133133
sendNotif([requestorSocketPort], MATCHING_EVENT.MATCHING);
134134
await redisClient.hSet(getPoolKey(requestorUserId), 'pending', 'false');
135135

136-
const clause = [`-@userId:(${requestorUserId}) @pending:(true)`];
136+
let clause = [`-@userId:(${requestorUserId})`, '@pending:(true)'];
137137

138138
if (difficulty) {
139139
clause.push(`@difficulty:{${difficulty}}`);
@@ -143,6 +143,9 @@ async function match() {
143143
clause.push(`@topic:{${topic}}`);
144144
}
145145

146+
// Push UserID clause to the back.
147+
clause = clause.reverse();
148+
146149
const searchParams = {
147150
LIMIT: { from: 0, size: 1 },
148151
SORTBY: { BY: 'timestamp', DIRECTION: 'ASC' },

0 commit comments

Comments
 (0)