Merge branch 'master' of github.com:poolifier/poolifier
[poolifier.git] / src / utility-types.ts
index 980c00896a0ebf23f75162605cccf52548cc535f..fa1c0ffefdf27e6996789cc444f44d81de9076fc 100644 (file)
@@ -9,15 +9,15 @@ import type { IWorker, Task } from './pools/worker'
  */
 export interface TaskError<Data = unknown> {
   /**
-   * Worker id.
+   * Task name triggering the error.
    */
-  readonly workerId: number
+  readonly name: string
   /**
    * Error message.
    */
   readonly message: string
   /**
-   * Data passed to the worker triggering the error.
+   * Data triggering the error.
    */
   readonly data?: Data
 }
@@ -28,6 +28,10 @@ export interface TaskError<Data = unknown> {
  * @internal
  */
 export interface TaskPerformance {
+  /**
+   * Task name.
+   */
+  readonly name: string
   /**
    * Task performance timestamp.
    */
@@ -61,14 +65,10 @@ export interface WorkerStatistics {
  */
 export interface MessageValue<Data = unknown, ErrorData = unknown>
   extends Task<Data> {
-  /**
-   * Worker id.
-   */
-  readonly workerId?: number
   /**
    * Kill code.
    */
-  readonly kill?: KillBehavior | 1
+  readonly kill?: KillBehavior | true
   /**
    * Task error.
    */
@@ -82,13 +82,13 @@ export interface MessageValue<Data = unknown, ErrorData = unknown>
    */
   readonly statistics?: WorkerStatistics
   /**
-   * Whether the worker has started or not.
+   * Whether the worker is ready or not.
    */
-  readonly started?: boolean
+  readonly ready?: boolean
   /**
-   * Whether the worker is dynamic or not.
+   * Whether the worker starts or stops its aliveness check.
    */
-  readonly dynamic?: boolean
+  readonly checkAlive?: boolean
 }
 
 /**