perf(inferium-harvester): do not continue when all needed seeds are removed

This commit is contained in:
Guillaume ARM 2024-05-24 16:35:26 +02:00
parent 4502db1ba1
commit 6b36dd3c92

View File

@ -361,7 +361,8 @@ end
local function removeSeeds(seeds, config) local function removeSeeds(seeds, config)
goToHarvestPoint(config) goToHarvestPoint(config)
print('> remove ' .. utils.sizeof(seeds) .. ' seed(s)') local nbOfSeedsToRemove = utils.sizeof(seeds)
print('> remove ' .. nbOfSeedsToRemove .. ' seed(s)')
local stateSeeds = seeds -- warning: do not mutate the data (only the ref) local stateSeeds = seeds -- warning: do not mutate the data (only the ref)
local nbBlockTraveled = 0 local nbBlockTraveled = 0
@ -381,6 +382,10 @@ local function removeSeeds(seeds, config)
end end
stateSeeds = removeFirst(stateSeeds, found) stateSeeds = removeFirst(stateSeeds, found)
nbOfSeedsToRemove = nbOfSeedsToRemove - 1
if nbOfSeedsToRemove < 1 then
break
end
end end
if i ~= config.length then if i ~= config.length then