The Problem
I attempted to use GetRequestBudgetForRequestType() to prevent my custom level creator from throttling while loading players’ levels from my DataStores.
Bizarrely, if the player refreshes the page many times consecutively, GetAsync() will throttle even when the server’s request budget is still above 0.
Here is a screenshot demonstrating the problem:
Developer Log
And here are my code samples:
The Functions That Query the Budgets
--Get DataStore budget
local function getGetBudget()
local budget = DataStoreService:GetRequestBudgetForRequestType(Enum.DataStoreRequestType.GetAsync)
print("Current GetAsync budget:", budget)
return budget
end
local function getSetBudget()
local budget = DataStoreService:GetRequestBudgetForRequestType(Enum.DataStoreRequestType.SetIncrementAsync)
print("Current SetAsync budget:", budget)
return budget
end
local function getSetSortedBudget()
local budget = DataStoreService:GetRequestBudgetForRequestType(Enum.DataStoreRequestType.SetIncrementSortedAsync)
print("Current SetAsyncSorted budget:", budget)
return budget
end
local function getGetSortedBudget()
local budget = DataStoreService:GetRequestBudgetForRequestType(Enum.DataStoreRequestType.GetSortedAsync)
print("Current GetAsyncSorted budget:", budget)
return budget
end
The Code That Throttles
if getGetBudget() < 5 then
repeat wait() until getGetBudget() > 5
end
if getGetSortedBudget() < 5 then
repeat wait() until getGetSortedBudget() > 5
end
if getSetSortedBudget() < 5 then
repeat wait() until getGetSortedBudget() > 5
end
if getSetBudget() < 5 then
repeat wait() until getGetSortedBudget() > 5
end
local success, level = pcall(function()
--This is a part that's being throttled
return tempds:GetAsync(levelindex)
end)
if level then
--Insert code to load the level's data here
end
Conclusion
Either GetRequestBudgetForRequestType() does not accurately return the budget, or there is a hidden limit other than the ones specified in the Data Store’s documentation.
Although this problem does not affect my game unless the player decides to spam the search button, I would like clarification about what the problem actually is.