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();
});
question from:
https://stackoverflow.com/questions/65849375/should-i-close-page-in-puppetter-cluster-task-closure-when-using-long-lasting-cl 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…