thomasdondorf / puppeteer-cluster

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

Cluster.queue() await doesn't work #541

Closed 4e576rt8uh9ij9okp closed 2 months ago

4e576rt8uh9ij9okp commented 3 months ago

Hi there, I have an issue, I want to wait for the queue and tested it with await and I wanted to log the result but it logs before the await.

    let result = await cluster.queue('https://www.cpu-monkey.com/de/cpu_benchmark-cinebench_2024_single_core', doSomething)
    console.log(result)

the function is a async function with a return. The function has many lines that's why I'm not posting it here, logging the return data like:

async function doSomething(){
    let data = await somethingThatReturnsText()
    console.log(data)
    return data
}

So what I want to do, is I want to merge the data and push it to a database.