Hey, recently my game always has the warning “DataStore request is added to queue, further requests will be dropped”. I read about the limit on this page
So I modified my code to not exceed the limit, but the error persists. Now I’m wondering is the limit applied to ALL the datastores instead of individual datastores? If so I need to modify my code even more.
How many datastores you have in game?
You still doing excessive requests to them within a short period of time I think.
When you find this issue? When player is leaving? while is playing?
How oftern you are saving into the datastores?
I have two normal datastores that only saves when the player is leaving, which is probably not the issue
I also have three ordered datastores; the first and second one saves every time a player levels up (one is job level, another is combat level so I can’t use one datastore), and the third one saves when the player leaves.
For the ordered datastores, here is the loop for GetSortedAsync():
while task.wait(30) do
for i, plr in pairs (game.Players:GetPlayers()) do
task.wait(0.5)
updateCacheCombatTop(plr)
updateCacheTop(plr)
end
end
And the code for updateCacheCombatTop() and updateCacheTop() has one GetSortedAsync() line inside it only.
Edit: The warning only occurs for Ordered Datastores, I’ve calculated that GetSortedASync() is called about 16 times per minute total, including all three ordered datastores. On roblox’s documentation it says that the limit is 5 + (numPlayers * 2) requests per minute, so I’m clearly exceeding the limit. But is the limit for one datastore only or is it for all datastores in the server?
So, you have a loop that each 30 seconds, its reading Top and Combat ordered datastore, but you are doing it PER player?
How many values are you asking with the GetSortedASync() ?
Lets say you ask for a top 10.
Once you got the 10 values, why asking again once per player in game? With only one request each 30 seconds is more than enough, no need to ask one time per each player each 30 secs.
Or what is the purpose using GetSortedAsync() once per player instead of just getting a range of values from the datastore?
Oh wow, thank you so much for your advice! I just realized I could have done this better, so instead of requesting per player, I can just request it all at once and then cache it locally for each player. Thanks!