X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futility-types.ts;h=21a442538d4988eba011f7904b2467cc895c3593;hb=8881ae32256c9a9ebe6d78c95672f610a3f46719;hp=54e66e1bbe9432c1c23c2851ca0466486d5efed5;hpb=70c7d7d3af9c38417416ca9096a6ab3ae835b5d0;p=poolifier.git diff --git a/src/utility-types.ts b/src/utility-types.ts index 54e66e1b..21a44253 100644 --- a/src/utility-types.ts +++ b/src/utility-types.ts @@ -19,20 +19,28 @@ export type Draft = { -readonly [P in keyof T]?: T[P] } */ export interface MessageValue< Data = unknown, - MainWorker extends ClusterWorker | MessagePort | unknown = unknown + MainWorker extends ClusterWorker | MessagePort = ClusterWorker | MessagePort > extends Task { /** * Kill code. */ readonly kill?: KillBehavior | 1 /** - * Error. + * Task error. */ readonly error?: string + /** + * Task data triggering task error. + */ + readonly errorData?: unknown /** * Runtime. */ readonly runTime?: number + /** + * Wait time. + */ + readonly waitTime?: number /** * Reference to main worker. */ @@ -48,6 +56,7 @@ export interface MessageValue< export type WorkerSyncFunction = ( data?: Data ) => Response + /** * Worker asynchronous function that can be executed. * This function must return a promise. @@ -58,6 +67,7 @@ export type WorkerSyncFunction = ( export type WorkerAsyncFunction = ( data?: Data ) => Promise + /** * Worker function that can be executed. * This function can be synchronous or asynchronous. @@ -68,8 +78,9 @@ export type WorkerAsyncFunction = ( export type WorkerFunction = | WorkerSyncFunction | WorkerAsyncFunction + /** - * Worker functions that can be executed object. + * Worker functions that can be executed. * This object can contain synchronous or asynchronous functions. * The key is the name of the function. * The value is the function itself.