Merge most of the stuff from jerome-benoit:issue-62-ts-standard
[poolifier.git] / src / fixed.ts
index 39f55c943bb35ccb2064e3d2a075f7230b5201ec..dee28c53fc00d0f62f5d9ea753a8ecad3151bba3 100644 (file)
@@ -1,9 +1,4 @@
-import {
-  isMainThread,
-  MessageChannel,
-  SHARE_ENV,
-  Worker
-} from 'worker_threads'
+import { MessageChannel, SHARE_ENV, Worker, isMainThread } from 'worker_threads'
 
 function empty () {}
 const _void = {}
@@ -63,10 +58,12 @@ export default class FixedThreadPool<Data = any, Response = any> {
     public readonly filePath: string,
     public readonly opts: FixedThreadPoolOptions = { maxTasks: 1000 }
   ) {
-    if (!isMainThread)
+    if (!isMainThread) {
       throw new Error('Cannot start a thread pool from a worker thread !!!')
-    if (!this.filePath)
+    }
+    if (!this.filePath) {
       throw new Error('Please specify a file with a worker implementation')
+    }
 
     for (let i = 1; i <= this.numThreads; i++) {
       this._newWorker()