Not exactly sure what the problem you're having is, but the most efficient way to handle a GetAll response is to ignore the event. just scan and keep track of your position in the results with periodic updates.
Lua Code:
local ScanPos;
local TotalAuctions = 1;
local Scanning = false;
local LastScanTime = 0;
Scanner = {};
function Scanner:Ready()
return AuctionFrame and AuctionFrame:IsShown() and select(2,CanSendAuctionQuery());
end
function Scanner:CanStart()
return (not Scanning) and self:Ready(), LastScanTime, 900;
end
function Scanner:Start()
Scanning = true;
end
function Scanner:OnFinished(incomplete)
Scanning, ScanPos, TotalAuctions = false;
AuctionFrameBrowse:RegisterEvent('AUCTION_ITEM_LIST_UPDATE');
end
C_Timer.NewTicker(0.1,function()
if not Scanning then return end
local ready = Scanner:Ready();
--[[
if not TotalAuctions then -- first grab the auctionhouse size, this can be skipped
if not ready then return end
AuctionFrameBrowse:UnregisterEvent('AUCTION_ITEM_LIST_UPDATE');
EventHandler:Register('AUCTION_ITEM_LIST_UPDATE',function()
TotalAuctions = select(2,GetNumAuctionItems("list"))
--print('total:',TotalAuctions);
return true;
end);
QueryAuctionItems("",nil,nil,0,0,0,0,0,0,false);
return;
end
--]]
if not ScanPos then -- init scan
if not ready then return end
--print('Downloading');
ScanPos = 0;
LastScanTime = time();
QueryAuctionItems("",nil,nil,0,0,0,0,0,0,true); -- GetAll
return;
end
if CanSendAuctionQuery() then -- scan complete
Scanner:OnFinished();
return;
end
-- continue parsing auction data.
local n, total = GetNumAuctionItems("list");
if n ~= total or n <= ScanPos then
return -- bad data block
end
local GetAuctionItemInfo = GetAuctionItemInfo;
for i = ScanPos+1, n do
--this is where you call your auction (single) result handler
--Database:AddAuction(GetAuctionItemInfo('list', i));
end
print(n..'/'..TotalAuctions..': +'..(n-ScanPos),'('..floor((n/TotalAuctions)*100)..'%)');
ScanPos = n;
end);
--[[
EventHandler:Register('AUCTION_HOUSE_CLOSED',function()
if ScanPos then -- Scan interrupted
Scanner:OnFinished(true);
end
end);
--]]