Should I close page in puppetter cluster task closure when using long lasting cluster

59 Views Asked by At

I have a cluster for which I have defined a task. As per example in the README.md, I have a closure which accepts a page instance as an argument. I navigate to the page and capture a screenshot. I don't do anything else with the page instance. In the README.md example, there's an await for idle event and then the cluster is closed. However I have a cluster which I virtually never want to close. Should I change the behaviour of my closure in that scenario to close the page?

I suspect I have got a memory leak somewhere in my service and one of the causes I am investigating is whether the cluster closes pages after I am done using them. I use concurrency: Cluster.CONCURRENCY_CONTEXT option.

await puppeteer.task(async ({ page }) => {
  // ... my screenshot logic

  // do I need to do this?
  await page.close();
});
0

There are 0 best solutions below