From d0cdf9560e17ce1fdef259ff7f85b13841909396 Mon Sep 17 00:00:00 2001 From: WZWren <115881359+WZWren@users.noreply.github.com> Date: Mon, 21 Oct 2024 01:47:37 +0800 Subject: [PATCH] Add MS4 requirements --- matching-service/consumer/process_request.go | 21 +++++++++++++++++++ .../components/questionpage/Matchmaking.tsx | 8 +++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/matching-service/consumer/process_request.go b/matching-service/consumer/process_request.go index 1b479c8d5c..b8a4f77a23 100644 --- a/matching-service/consumer/process_request.go +++ b/matching-service/consumer/process_request.go @@ -5,6 +5,7 @@ package consumer import ( + "context" "encoding/json" "fmt" "matching-service/models" @@ -20,12 +21,32 @@ func Process(msg rabbit.Delivery, clientMappings *db.ClientMappings, roomMapping return fmt.Errorf("error unmarshling the request from JSON: %s", err.Error()) } + keys, err := clientMappings.Conn.Keys(context.Background(), "*").Result() + + if err != nil { + fmt.Println("error getting keys") + } else { + fmt.Printf("queue before user match: %s / ",keys) + } + room, err := clientMappings.HandleRequest(request) if err != nil { return fmt.Errorf("error handling incoming request: %s", err.Error()) } + keys, err = clientMappings.Conn.Keys(context.Background(), "*").Result() + + if err != nil { + fmt.Println("error getting keys") + } else { + fmt.Printf("queue after user match:%s / ", keys) + } + + if err != nil { + return fmt.Errorf("error handling incoming request: %s", err.Error()) + } + fmt.Println("success handling incoming request!") if room != nil { if err := roomMappings.SendToStorageBlob(room); err != nil { diff --git a/peerprep/components/questionpage/Matchmaking.tsx b/peerprep/components/questionpage/Matchmaking.tsx index 92691071af..64a35e1b87 100644 --- a/peerprep/components/questionpage/Matchmaking.tsx +++ b/peerprep/components/questionpage/Matchmaking.tsx @@ -55,12 +55,16 @@ const usePeriodicCallback = ( const Matchmaking = () => { const router = useRouter(); const [isMatching, setIsMatching] = useState(false); - const [difficultyFilter, setDifficultyFilter] = useState(Difficulty.Easy); - const [topicFilter, setTopicFilter] = useState(["all"]); const { difficulties, topicList } = useQuestionFilter(); + const [difficultyFilter, setDifficultyFilter] = useState(Difficulty.Easy); + const [topicFilter, setTopicFilter] = useState(topicList); const { userid } = useUserInfo(); const timeout = useRef(); + useEffect(() => { + setTopicFilter(topicList); + }, [topicList]); + const stopTimer = () => { // if user manually stopped it clear timeout if (timeout.current) {