implement alternative match-making approach with Lua scripts in Redis
This commit is contained in:
@@ -1,19 +1,6 @@
|
||||
class Api::MatchmakingController < ApplicationController
|
||||
def create
|
||||
result = MatchmakingService.find_match(current_user.id)
|
||||
|
||||
if result
|
||||
render json: {
|
||||
match_id: result[:match_id],
|
||||
game_token: result[:game_token],
|
||||
game_server: result[:game_server],
|
||||
players: result[:players]
|
||||
}
|
||||
else
|
||||
render json: { error: "No opponent found. Try again." }, status: :request_timeout
|
||||
end
|
||||
end
|
||||
|
||||
# Explicit cancellation. Normally the search is cancelled automatically
|
||||
# when the MatchmakingChannel subscription is closed.
|
||||
def destroy
|
||||
MatchmakingService.cancel(current_user.id)
|
||||
render json: { message: "Matchmaking cancelled" }
|
||||
|
||||
Reference in New Issue
Block a user