OrderedDataStore Pages Object is never "IsFinished" resulting in finite loops when N = 0

The IsFinished property on DataStores is never set to “True” even when we’re on the last page. The :AdvanceToNextPageAsync() method fails silently and we never finish iterating over the datastore. This duplicates data and results in a ton of errors.

local DataStoreService = game:GetService("DataStoreService")

local orderedDataStore = DataStoreService:GetOrderedDataStore("test_store")
orderedDataStore:SetAsync("entry_key", 1)

task.wait(1)

local dataStorePages = orderedDataStore:GetSortedAsync(false, 100)
local pageData = dataStorePages:GetCurrentPage()
local iterations = 10
while pageData and iterations > 0 do
	iterations -= 1
	
	print(dataStorePages.IsFinished) --> false (always, 10 times)

	dataStorePages:AdvanceToNextPageAsync()
	pageData = dataStorePages:GetCurrentPage()
end
3 Likes

Note: Here’s my workaround:

This is a dupe:

I don’t know why this hasn’t been addressed yet.

1 Like

Believe it or not, it is does not reproduce for everyone. Nonetheless, we were able to reproduce it now and are working on a fix. Stay tuned.

1 Like

It should be fixed now, please confirm.

1 Like