Skip to content

dispose workers necessary?  #76

@pcace

Description

@pcace

Hi there, i am starting to work with tinypools so excuse if the question is kind of stupid.

i have a node js api using bullMQ for long running tasks. within each task there are between 20 to 100 long running processes wich i want to run in parallel using tinypool. currently i do this like so:

bullmqWorker.ts:

    const { Tinypool } = await importDynamic('tinypool')

    const extruderWorkerPool = new Tinypool({
        // filename: __dirname + '/getextruderWorkerPool.ts',
        filename: new URL(
            './extruderPoolWorker.js',
            require('url').pathToFileURL(__filename).toString()
        ).href,
        runtime: 'worker_threads',
        minThreads: 1,
        maxThreads: 16
    })

    const extruderReturnPromises: Promise<ReturnType>[] = []
    while (distance <= highZ + stepSize) {

        extruderReturnPromises.push(extruderWorkerPool.run({
            folder, polygonFile, distance, skipMesh, weightsFile
        }))

        distance = distance + stepSize
    }
    const results = await Promise.all(extruderReturnPromises)

the question i have is, if it is necessary to dispose the Tinypool pool? or do i just leave it like this and once all jobs are done they are gone?

Thank you so much for clarification!

cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions