Skip to content

Commit

Permalink
Add MS4 requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
WZWren committed Oct 20, 2024
1 parent d8f75ac commit d0cdf95
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
21 changes: 21 additions & 0 deletions matching-service/consumer/process_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package consumer

import (
"context"
"encoding/json"
"fmt"
"matching-service/models"
Expand All @@ -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 {
Expand Down
8 changes: 6 additions & 2 deletions peerprep/components/questionpage/Matchmaking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,16 @@ const usePeriodicCallback = (
const Matchmaking = () => {
const router = useRouter();
const [isMatching, setIsMatching] = useState<boolean>(false);
const [difficultyFilter, setDifficultyFilter] = useState<string>(Difficulty.Easy);
const [topicFilter, setTopicFilter] = useState<string[]>(["all"]);
const { difficulties, topicList } = useQuestionFilter();
const [difficultyFilter, setDifficultyFilter] = useState<string>(Difficulty.Easy);
const [topicFilter, setTopicFilter] = useState<string[]>(topicList);
const { userid } = useUserInfo();
const timeout = useRef<NodeJS.Timeout>();

useEffect(() => {
setTopicFilter(topicList);
}, [topicList]);

const stopTimer = () => {
// if user manually stopped it clear timeout
if (timeout.current) {
Expand Down

0 comments on commit d0cdf95

Please sign in to comment.