Auctionator

Auctionator

141M Downloads

Identical pages check stuck in infinite loop

khebul opened this issue ยท 1 comments

commented

Brief Description of Bug

If two auction pages have same postings from two different authors, scan won't advance

Steps to Reproduce

  • Have two identical pages with items from different authors
  • Try to sell items those people were selling
  • Scan will be stick in infinite loop on "duplicate" page

Workaround

I have added retry counter to duplicate checks. Workaround code:

Auctinator.lua

local aoa_count = 0
local page_update_retries = 4

function Atr_OnAuctionUpdate (...)
  Auctionator.Debug.Message( 'Atr_OnAuctionUpdate' )

  local numBatchAuctions, totalAuctions = Atr_GetNumAuctionItems("list");

  aoa_count = aoa_count + 1

  if (gAtr_FullScanState == ATR_FS_STARTED) then
    Atr_FullScanBeginAnalyzePhase()   -- handle in idle loop to slow down
    return
  end

  if (gAtr_FullScanState == ATR_FS_SLOW_QUERY_SENT) then
    Atr_FullScanBeginAnalyzePhase()
    Atr_FullScanAnalyze()           -- handle here since it's just one page
    return
  end

  if (not Atr_IsTabSelected()) then
    Atr_ClearScanCache()    -- if not our tab, we have no idea what happened so must flush all caches
    return;
  end;

  if (Atr_Buy_OnAuctionUpdate()) then
    return
  end

  if (gCurrentPane.activeSearch and gCurrentPane.activeSearch.processing_state == Auctionator.Constants.SearchStates.POST_QUERY) then
    print("Retries: ",  page_update_retries)
    gCurrentPane.activeSearch:CapturePageInfo();
    local isDup = gCurrentPane.activeSearch:CheckForDuplicatePage (page_update_retries);

    if (not isDup) then
      page_update_retries = 4
      local done = gCurrentPane.activeSearch:AnalyzeResultsPage();

      if (done) then
        gCurrentPane.activeSearch:Finish();
        Atr_OnSearchComplete ();
      end
    else 
        page_update_retries = page_update_retries - 1
    end
  end

end

AuctinatorScan.lua

function AtrSearch:CheckForDuplicatePage (retryCount)

  local isDup = self.query:CheckForDuplicatePage(self.current_page);
  if (retryCount <= 0) then
    return false
  end
  if (isDup) then
    self.current_page   = self.current_page - 1;   -- requery the page
    self.processing_state = Auctionator.Constants.SearchStates.PRE_QUERY;
  end

  return isDup;
end
commented

Line segment

Aucitonator.lua lines 1933 to 1979

AuctionatorScan.lua line 375 to 385