implement alternative match-making approach with Lua scripts in Redis

This commit is contained in:
2026-10-25 15:57:24 +03:00
parent 582ecb7c74
commit acdaebd491
19 changed files with 796 additions and 139 deletions
@@ -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" }