AardCrowley / Search-and-Destroy

Safe, Legal Search and Destroy
10 stars 14 forks source link

Pagesize does not set to 0 on xset index areas. #76

Closed AardCrowley closed 3 years ago

AardCrowley commented 3 years ago

Simple fix, but to reproduce:

  1. Set pagesize to anything but 0 (pagesize 45, for example)
  2. xset index areas

You will see the page break at some point.

AardCrowley commented 3 years ago

Can you do me a favor? Type 'config' and post what your game prompt is set to. I have a suspicion, and though I can confirm it easily on my end, it helps having another example to work with.

mtrp12 commented 3 years ago

I think i figured out the issue with pagesize. If I figured correctly there is a race condition going on. the command "pagesize 0" is a server command. It goes to server and comes back with the result. While the plugin is local. So, when you execute "areas 1 300 keyword" right after disabling page size, it executes simultaneously with disable pagesize command. So, in the network race, if pagesize 0 reaches server first, we get ok result. Otherwise, it hangs. That's probably the reason I was getting random success if I keep spamming "xset index areas".

--  [[ Area index process ]]
    function area_index_process()
        DebugNote("Processing area index")
        Execute("xset suspend page size")    --  this command racing with command below
                -- add wait here
        DoAfterSpecial(0.1, [[ SendNoEcho("areas 1 300 keyword") ]], sendto.script)    -- fast
    end

I added a delay in the place mentioned above, and it worked fine. When removed again, it borked.

Now, since this is a command over the network, the wait may be unreliable. Because, if people lagging, it may take more time than you thought. Best would be to wait for "paging disable" text reply from server from the output of "pagesize 0". image

Then you can process the areas.

AardCrowley commented 3 years ago

Hmm, what's interesting is that it has ALWAYS been that way with no prior issues. I may rework the code to use 'wait' instead since it can match a trigger and proceed from there. Thanks for debugging it!