Hey there! Thanks for sharing the details—I can see why this delay is frustrating. Using MemoryStoreService
for a global party invite system is a solid idea, but the Internal Error: API: Queue.Read, Data Structure: partyInvites
error suggests you might be hitting rate limits or internal issues with MemoryStoreService
.
Since you’re polling with a while true
loop and ReadAsync
, the frequent calls might be overwhelming the service, especially if many players are doing this at once. MemoryStoreService
has strict rate limits (e.g., ~100 reads per minute per queue globally), and exceeding them can trigger these errors, leading to the 20-second delays you’re seeing.
Here’s a quick suggestion: instead of polling with a tight loop, you could use a longer delay between ReadAsync
calls (like wait(5)
) to stay under the rate limit. Better yet, consider using a pub-sub pattern with MessagingService
to notify players of invites instantly, then use MemoryStoreService
only to fetch the invite data when a message is received. This would reduce the load on MemoryStoreService
significantly.
Here’s a rough example of how you might combine the two:
local MemoryStoreService = game:GetService("MemoryStoreService")
local MessagingService = game:GetService("MessagingService")
local Players = game:GetService("Players")
local INVITE_QUEUE = MemoryStoreService:GetQueue("partyInvites")
-- On invite send (server)
local function sendInvite(senderId, receiverId, partyData)
INVITE_QUEUE:AddAsync({sender = senderId, party = partyData}, 3600, receiverId)
MessagingService:PublishAsync("PartyInvite_" .. receiverId, {senderId = senderId})
end
-- On client/server receiving invite
MessagingService:SubscribeAsync("PartyInvite_" .. Players.LocalPlayer.UserId, function(message)
local senderId = message.Data.senderId
local success, inviteData = pcall(INVITE_QUEUE.ReadAsync, INVITE_QUEUE, senderId, 1, false, 10)
if success and inviteData then
print("Received invite from", senderId, ":", inviteData)
-- Show invite UI to player
end
end)
This way, MessagingService
handles the instant notification, and MemoryStoreService
is only queried when needed, avoiding the polling loop entirely. It should help with the delays and errors.
If you’re still seeing issues, could you share more about your loop setup (e.g., how often it polls) or the number of players involved? That’d help narrow it down further. Hope this helps!