# Matchmaker not working when minimum is greater or equal to 4

**URL:** <https://forum.heroiclabs.com/t/matchmaker-not-working-when-minimum-is-greater-or-equal-to-4/1400>\
**Category:** Local Setup\
**Tags:** server-framework\
**Created:** [February 26, 2021, 2:19am UTC](https://forum.heroiclabs.com/t/matchmaker-not-working-when-minimum-is-greater-or-equal-to-4/1400 "2021-02-26T02:19:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chounry](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/chounry/32/406_2.png) [@chounry](https://forum.heroiclabs.com/u/chounry)\
**Post date:** [February 26, 2021, 2:19am UTC](https://forum.heroiclabs.com/t/matchmaker-not-working-when-minimum-is-greater-or-equal-to-4/1400/1 "2021-02-26T02:19:56Z")

</div>

I’m using  
Nakama version : 3.1.1

When I add match maker with minimum less or equal to 3 it work but if above 3 it doesn’t work. I check the code of `matchmaker.go` of nakama, I see the code doesn’t actually modify actual array. Check out below block of code from `matchmaker.go` and some comments.

```go
entryCombos := make([][]*MatchmakerEntry, 0, 5) // <----- Not array of array pointer

for _, hit := range result.Hits {
...
var foundCombo []*MatchmakerEntry
for _, entryCombo := range entryCombos { // <----- entryCombo is copied out
   if len(entryCombo)+len(entries)+index.Count <= index.MaxCount {

   		for _, entry := range entryCombo {
   			if _, found := hitIndex.SessionIDs[entry.Presence.SessionId]; found {
   				sessionIdConflict = true
   				break
   			}
   		}
   		if sessionIdConflict {
   			continue
   		}

   		entryCombo = append(entryCombo, entries...) <----- then modify the copied, not the actual array
   		foundCombo = entryCombo
   		break
   
   	}
....
}

```

I have solved this by modifying the `entryCombos` variable and let the loop access it as pointer accordingly.

```go
entryCombos := make([][]*MatchmakerEntry, 0, 5)
// to
entryCombos := make([]*[]*MatchmakerEntry, 0, 5)
				  // ^ Add this 

```

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [February 26, 2021, 12:27pm UTC](https://forum.heroiclabs.com/t/matchmaker-not-working-when-minimum-is-greater-or-equal-to-4/1400/2 "2021-02-26T12:27:36Z")

</div>

@chounry Thanks for the detailed investigation. I see you’ve opened an issue and a pull request which we can use to carry on the discussion about the change. I don’t think your solution is quite right but we can discuss it further there. 👍

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [February 26, 2021, 12:27pm UTC](https://forum.heroiclabs.com/t/matchmaker-not-working-when-minimum-is-greater-or-equal-to-4/1400/3 "2021-02-26T12:27:43Z")

</div>


