How to make a data queue?

I’m having trouble understanding how to save players through a queue. Does anyone know how, or maybe know a resource that may be useful?

1 Like

Well a very simple datastore queue system could work by storing the data inside of a table and have a while true do loop which will wait for one minute and every one minute it will calculate how many requests/players can have there data sent to be stored every minute and store that much data from the table and then off course remove there data from the table if that makes sense at all?

1 Like

I didn’t know this was possible what’s happens if the user rejoins before their data was saved?

Yea that is an issue though. There is no real way to create a data queue any other way though from my knowledge.

In general you should not be relying on a data store queue because there are other ways to reduce the amount you save someones data (like doing it when they leave and also ever so often like 5-10 minutes when they are in-game) which should reduce the need for this but if for some reason there is a large amount of data a data queue is generally better then nothing and having mass issues with data loss.

You could try something like what profile service does, splits up the data and sorts them to send and locks it so no other server can use it until released try reading some of its source code

Would you not have the exact same issue or worse data would not load correctly in a different server?

Normally I don’t need a queue but with the game I recently released, players are leaving super quick, and it’s filling up datastore queue. I need a custom one to manage.

Use Datastore2 then. Datastore service won’t help you here because you cannot create queues.

1 Like

ProfileService session locks, and it makes sure the data get saved. When session locked no other server can access until unlocked, it automatically splits the data and saves safely without big queues

1 Like

Roblox automatically handles DataStore queueing itself, if you issue too many requests to a single key, that request is delayed and then handled when possible.