MemoryStoreService:ReadAsync() doesn't prioritise items properly

As the MemoryStoreQueue service was developed, I decided to create a matchmaking system from scratch, however, I ran into the problem of prioritising data through its function, :ReadAsync().

When the function is run, it returns an array of userIds (of every index’s value), but the index seems to be sorted out (like an array without values), even though I can’t seem to find their rating (the variable that prioritises the userId).

Let me give you an example. Here’s the table of a userId, with the .Rating being my desired variable when passed through the 3rd argument through ReadAsync:
image

It’s then used as:

local success, result = pcall(function()
	return getQueue:AddAsync(userId, 60, playerRatings[userId].Rating) 
end)

But it’s read as:
image

Why is the index 1 and not the rating, which in this case, 7? It should prioritise it. Where else is it prioritised?

1 Like

Figured it out. The queue takes the highest priority value to the lowest secretly, which are then indexed corresponding to their place in the queue. MemoryStoreSortedMap would be more useful in this case.

1 Like