DataStore request was added to queue

I’m changing my current Server script from DataStore2 to DataStore.
I have a function that receives any change sent from LocalScript and stores it in a table Game in DataStore.

local function SaveGame(Player, Game)
	local GameStore = DataStoreService:GetDataStore("Game", Player)
	JogoStore:SetAsync("Game", Game)
end

However, every time the function is invoked I get this warning:

DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = Game

How to fix that?

2 Likes

you cannot pass physical games through datastores. please read the docs next time and save tables instead. Now that thats covered, you are getting this issue because you are calling setasync or getasync too many times. You can view the limits here Documentation - Roblox Creator Hub
However, if you do a single datastore request when a player joins and when they leave it will not overload the queue. If you can show the code where you call that function, that would also help.

2 Likes

Yeah, you will get that. As long as you aren’t reaching your DS limit, you can just ignore it.

That is bad idea, you shouldnt ignore it at any case as it shows how you are going over the DS limit.

The datastore limit is 6 (higher, see post 12) per minute IIRC, I get the error when I’m doing a single datastore. I have been told the same elsewhere. (about the error, not limit)

2 Likes

I will try to do similar to DataStore2 and save the user data only when he leaves the game:
https://developer.roblox.com/en-us/articles/Saving-Player-Data#save-data-on-exit

1 Like

it might be, I might just be paranoid as anytime that happened to me when I was learning datastores it caused issue.

what you could use is ProfileService. It is VERY well made and is used by a lot of people. Its main feature is session locking which helps prevent duplication glitches

Yeah, you will get that output every time data is saved. You don’t have to worry about it as long as you aren’t going over the limit, it gets annoying but wrapping it in a pcall should resolve it, and you shouldn’t see it anymore.

local s,e = pcall(function()
    JogoStore:SetAsync("Game", Game)
end
2 Likes

I dont think you will get that every output. That is bad and should be looked into. If it happens every once in a while its fine but if it happens everytime its saved thats just a disaster if the game becomes big.

2 Likes

If you are worried about data being lost/corrupted due to save size, you can JSONEncode your table, and then save it to the DS, and then JSONDecode when loading the data. JSONEncode formats the table into a string. Also, believe me, it isn’t anything to worry about. I’m saving quite a few values and have yet to run into any errors. It is also putting the same output right below.

According to the wiki, they’re a bit higher. You generally shouldn’t be hitting them if you’ve got things set up properly, though:
https://developer.roblox.com/en-us/articles/Datastore-Errors#server-limits
(60 to start, and then 10 for each player)

4 Likes

Yeah, that’s the problem:


I was trying to make many SetASync before 6 seconds.
So, as I said, I’ll try to save all data only when the user exits, using game.Players.PlayerRemoving.

2 Likes

I would prefer you mark mine as a solution as I stated the idea to do a single request and i am grinding for that dev forum regular rank

1 Like

How would I JSONEncode my table, could you give an example?

I take back what I said, I wouldn’t JSON encode or decode your table as this is done for you already upon :Set/UpdateAsync and GetAsync