Responsive Ad Area

Share This Post

test

Using puppeteer for cachewarmer

I have a long txt file with ~1000 urls, which needs to be executed, to warm the varnish cache. Since i need puppeteer, is that there is important content loaded by AJAX call.

This is my first attempt, but not master in node. The real issue is that it make a 100% load, and starts too many threads.

const puppeteer = require('puppeteer');
const readline = require('readline');
const fs = require('fs');

const rl = readline.createInterface({
    input: fs.createReadStream('varnish-warmer.txt')
  });

rl.on('line', (line) => {
(async () => {
    if (line != '') {
    const browser = await puppeteer.launch();
        const page = await browser.newPage();
        await page.goto(line);
        await page.waitFor(1000);

        browser.close();
    }

})();
});


Using puppeteer for cachewarmer
Using puppeteer for cachewarmer
test
{$excerpt:n}

Share This Post

Leave a Reply

Your email address will not be Publishedd. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Skip to toolbar