X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2Ftypescript%2Fpool.ts;h=de49c93ad6f8c73bc3cfaa680a78134cdd8daa56;hb=dc958990c4e9ef218c29d070ad58ce25fa4b42ed;hp=ab6d4f268b38a76520cf15b919948eae3e9eb924;hpb=c3581f79ea34bd89cbdff40ac6c44eb7394f7919;p=poolifier.git diff --git a/examples/typescript/pool.ts b/examples/typescript/pool.ts index ab6d4f26..de49c93a 100644 --- a/examples/typescript/pool.ts +++ b/examples/typescript/pool.ts @@ -1,11 +1,11 @@ -import { dirname, extname, join } from 'path' -import { fileURLToPath } from 'url' +import { dirname, extname, join } from 'node:path' +import { fileURLToPath } from 'node:url' +import type { MyData, MyResponse } from './worker' import { DynamicThreadPool, FixedThreadPool, availableParallelism } from 'poolifier' -import type { MyData, MyResponse } from './worker' const workerFile = join( dirname(fileURLToPath(import.meta.url)), @@ -38,3 +38,9 @@ export const dynamicPool = new DynamicThreadPool>( } } ) + +// eslint-disable-next-line @typescript-eslint/no-misused-promises +setTimeout(async () => { + await fixedPool.destroy() + await dynamicPool.destroy() +}, 3000)