Set Up Waiting Time
Last updated on
The Matchmaking service will look for possible players and set the maximum waiting time for the service to find another player to send a Matchmaking request.
// possible allies
possibleAllies := len(allTickets)
log.Printf("There are %v tickets in database with id: %v", possibleAllies, allUsers)
if len(allUsers) <= 1 {
go func() {
b := backoff.NewExponentialBackOff()
b.MaxElapsedTime = 5 * time.Second
checkDB := func() error {
foundUserIds, _ := titleMMService.checkAllies(namespace, userId, gameMode)
if foundUserIds != nil {
allUsers = foundUserIds
}
return nil
}
err = backoff.Retry(checkDB, b)
if err != nil {
log.Fatalf("error after retrying: %v", err)
}
}()
time.Sleep(5 * time.Second)
log.Printf("Not enough player! There is only %v player", possibleAllies)
message := "Not enough player"
response := events.APIGatewayProxyResponse{StatusCode: http.StatusInternalServerError, Body: message}
return response, nil
}