Merge dependabot/npm_and_yarn/examples/typescript/http-server-pool/fastify-hybrid...
[poolifier.git] / examples / typescript / pool.ts
index f85496434c2516eea46c7b5f1cde937565a2985d..57898d98a9d53a8c89c3d774847e9cae694a53fe 100644 (file)
@@ -1,12 +1,11 @@
-import { dirname, extname, join } from 'path'
-import { fileURLToPath } from 'url'
-import type { MyData, MyResponse } from './worker'
+import { dirname, extname, join } from 'node:path'
+import { fileURLToPath } from 'node:url'
+import type { MyData, MyResponse } from './worker.js'
 import {
   DynamicThreadPool,
   FixedThreadPool,
   availableParallelism
 } from 'poolifier'
-import type { MyData, MyResponse } from './worker'
 
 const workerFile = join(
   dirname(fileURLToPath(import.meta.url)),
@@ -39,3 +38,9 @@ export const dynamicPool = new DynamicThreadPool<MyData, Promise<MyResponse>>(
     }
   }
 )
+
+// eslint-disable-next-line @typescript-eslint/no-misused-promises
+setTimeout(async () => {
+  await fixedPool.destroy()
+  await dynamicPool.destroy()
+}, 3000)