thomasdondorf / puppeteer-cluster

Puppeteer Pool, run a cluster of instances in parallel
MIT License
3.2k stars 307 forks source link

Add new event taskinprogress #539

Open JeffersonGibin opened 4 months ago

JeffersonGibin commented 4 months ago

Why was this implemented?

This was implemented to make it possible to identify a task that is in progress. Currently, it is possible to identify an error and also if a task has been added to the queue. However, in situations where it is necessary to manage the 'progress' of tasks for database management, for example, it becomes somewhat complex.

How does it work?

cluster.on("taskinprogress", (data, isCallbackExecution) => {
    if (isCallbackExecution) {
        console.log("A callback is in progress", data);
    } else {
        console.log("A task is in progress and it is not a callback", data);
    }
});

Tests

Readme

Missing