feat: use priority queue for task queueing
[poolifier.git] / src / utility-types.ts
index 10d9183ca6f262cd25d475737d0e86613a55d247..aa4e219853caba926bc74867a2089827f6f69765 100644 (file)
@@ -100,6 +100,16 @@ export interface Task<Data = unknown> {
    * Task input data that will be passed to the worker.
    */
   readonly data?: Data
+  /**
+   * Task priority. Lower values have higher priority.
+   *
+   * @defaultValue 0
+   */
+  readonly priority?: number
+  /**
+   * Task worker choice strategy.
+   */
+  readonly strategy?: WorkerChoiceStrategy
   /**
    * Array of transferable objects.
    */
@@ -111,7 +121,7 @@ export interface Task<Data = unknown> {
   /**
    * Task UUID.
    */
-  readonly taskId?: string
+  readonly taskId?: `${string}-${string}-${string}-${string}-${string}`
 }
 
 /**