So I have a MemoryStoreQueue
with invisibilityTimeout
set to 0
. And the issue is that even after the RemoveAsync
is called, the queue still contains the item. I use a new queue every test, did I do something wrong?
Steps
Read 0 is empty, Correct
Add, adds an item to queue
Read 1, has 1 item, correct
Read 2, has 1 item, correct
Remove, remove using key provided by Read 2
Read 3, sure, has 1 item, maybe remove async isn’t done
Read 4, Still has 1 item??
task.wait(1)
Read 5, Okay, item is still there and not removed
Output:
Below is my test code.
--!strict
print("TestScript!")
local queue: MemoryStoreQueue = game:GetService("MemoryStoreService"):GetQueue("test3", 0);
local testVal1: {any} = {Hello="World"};
local function retryer(id: string, func)
for a=1, 8 do
local s, e = pcall(func);
if s == true then
break;
end
print("TestScript>> Retrying (",id,") ",a,"/8: ", e);
task.wait((a-1)^2);
end
end
retryer("Clear all", function()
local d, k = queue:ReadAsync(99, false, 3);
if k ~= nil then
queue:RemoveAsync(k);
end
print("TestScript>> Clear all read", d, k);
end)
task.wait(1);
retryer("Read 0", function()
print("TestScript>> Read 0",queue:ReadAsync(1, false, 3));
end)
retryer("Add", function()
queue:AddAsync(testVal1, 300)
print("TestScript>> Add", testVal1);
end)
retryer("Read 1", function()
print("TestScript>> Read 1",queue:ReadAsync(1, false, 3));
end)
local readVal, dataKey;
retryer("Read 2", function()
readVal, dataKey = queue:ReadAsync(1, false, 3);
end)
print("TestScript>> Read 2",readVal, dataKey);
task.spawn(function()
retryer("Remove", function()
queue:RemoveAsync(dataKey);
end)
print("TestScript>> Remove")
retryer("Read 4", function()
print("TestScript>> Read 4",queue:ReadAsync(1, false, 3));
end)
end)
retryer("Read 3", function()
print("TestScript>> Read 3",queue:ReadAsync(1, false, 3));
end)
task.wait(1);
retryer("Read 5", function()
print("TestScript>> Read 5",queue:ReadAsync(1, false, 3));
end)