From bb2c43b35201ce1eb5a394acc2a9d74182a09948 Mon Sep 17 00:00:00 2001 From: Mo Firouz Date: Tue, 16 Oct 2018 16:10:43 +0800 Subject: [PATCH] Set default matchmaker input query if none supplied with the request. --- CHANGELOG.md | 1 + server/pipeline_matchmaker.go | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c86b81e7..a2d557278 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr ### Fixed - Use leaderboard expires rather than end active IDs with leaderboard resets. - Better validation of tournament duration when a reset schedule is set. +- Set default matchmaker input query if none supplied with the request. ## [2.1.0] - 2018-10-08 ### Added diff --git a/server/pipeline_matchmaker.go b/server/pipeline_matchmaker.go index 54c6a5be1..d40a0c7f3 100644 --- a/server/pipeline_matchmaker.go +++ b/server/pipeline_matchmaker.go @@ -16,11 +16,12 @@ package server import ( "fmt" + "time" + "github.com/dgrijalva/jwt-go" "github.com/gofrs/uuid" "github.com/heroiclabs/nakama/rtapi" "go.uber.org/zap" - "time" ) func (p *Pipeline) matchmakerAdd(logger *zap.Logger, session Session, envelope *rtapi.Envelope) { @@ -46,8 +47,13 @@ func (p *Pipeline) matchmakerAdd(logger *zap.Logger, session Session, envelope * return } + query := incoming.Query + if query == "" { + query = "*" + } + // Run matchmaker add. - ticket, entries, err := p.matchmaker.Add(session, incoming.Query, minCount, maxCount, incoming.StringProperties, incoming.NumericProperties) + ticket, entries, err := p.matchmaker.Add(session, query, minCount, maxCount, incoming.StringProperties, incoming.NumericProperties) if err != nil { logger.Error("Error adding to matchmaker", zap.Error(err)) session.Send(false, 0, &rtapi.Envelope{Cid: envelope.Cid, Message: &rtapi.Envelope_Error{Error: &rtapi.Error{ -- GitLab