OrderedDataStore:GetSortedAsync() is not returning true on the last page.
This causes the while loop to run endlessly, causing rate limits.
Expected behavior
Pages.IsFinished to return true when the last page has been reached.
Repro Code
local orderedDS = game:GetService("DataStoreService"):GetOrderedDataStore("TestDS")
orderedDS:SetAsync("Test1", 10)
orderedDS:SetAsync("Test2", 1)
print("setted")
task.wait(5)
local pages = orderedDS:GetSortedAsync(true, 100)
while true do
local breaking = false
local page = pages:GetCurrentPage()
for _, data in ipairs(page) do
local key:string = data.key
local exist:number = data.value
print("key", key)
end
if pages.IsFinished then
-- We've reached the last page of results
breaking = true
else
-- There are more pages of results
pages:AdvanceToNextPageAsync()
print("advancing, IsFinished", pages.IsFinished)
end
if breaking then
break
end
end
It broke my game too, i spent lots of hours but couldnt find any solution. This literally zeroed my playerbase and still there isnt any update, I think this is a really critical issue and should be fixed like right now. I really wish engineers will fix it very soon
It seems like that this bug no longer occurrs on newly created ordered datastores even after saving 10,000 keys and then removing them however the bug still happens on old ordered datastores.
After investigating what the backend responds on a broken and a not broken datastore these are my findings:
Not Broken Ordered Datastore
Broken Ordered Datastore
The lastEvaluatedKey being an empty string is probably messing with robloxs check to determine if it IsFinished