I have this worker.js script where proxies are read from index.js and using Math.floor to randomize the order of the proxies and then use puppeteer to visit a URL. in index.js:
const proxies = fs.readFileSync('./proxies.txt')
and in worker.js file:
const index = Math.floor(Math.random() * workerData.proxies.length);
const browser = await puppeteer.launch({
args: ['--proxy-server=' + workerData.proxies[index]],
headless: "new",
executablePath: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome'
I don't wish to randomize, I just wish it to execute proxy 1 by 1 and then after last one, repeat from first one in sequence.
It looks like making a copy of
workerData.proxiesand then removing items 1 by 1 from that list using .slice() might do the job.