From 052226bd65eac21a3add863de2c5e585717709d4 Mon Sep 17 00:00:00 2001 From: Hao Luo Date: Fri, 28 Oct 2022 17:27:21 -0500 Subject: [PATCH] deprecated taskWorkers option in RouterOption Signed-off-by: Hao Luo --- .changeset/little-chairs-dance.md | 7 +++---- plugins/scaffolder-backend/src/service/router.ts | 11 +++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.changeset/little-chairs-dance.md b/.changeset/little-chairs-dance.md index 07cbf52389..f99b3443cb 100644 --- a/.changeset/little-chairs-dance.md +++ b/.changeset/little-chairs-dance.md @@ -1,12 +1,11 @@ --- '@backstage/plugin-scaffolder-backend': minor --- +Deprecated the `taskWorkers` option in RouterOptions in favor of `concurrentTasksLimit` which sets the limit of concurrentTasks in a single TaskWorker -Added optional "concurrentTasksLimit" option to TaskWorker +TaskWorker can now run multiple (defaults to 10) tasks concurrently using the `concurrentTasksLimit` option available in both `RouterOptions` and `CreateWorkerOptions`. -TaskWorker can now run multiple (defaults to 10) tasks concurrently. - -To use the option, in `createRouter`: +To use the option to create a TaskWorker: ```diff const worker = await TaskWorker.create({ diff --git a/plugins/scaffolder-backend/src/service/router.ts b/plugins/scaffolder-backend/src/service/router.ts index 9d4aa547f8..6ae54b6530 100644 --- a/plugins/scaffolder-backend/src/service/router.ts +++ b/plugins/scaffolder-backend/src/service/router.ts @@ -67,7 +67,16 @@ export interface RouterOptions { scheduler?: PluginTaskScheduler; actions?: TemplateAction[]; + /** + * @deprecated taskWorkers is deprecated in favor of concurrentTasksLimit option with a single TaskWorker + * @default 1 + */ taskWorkers?: number; + /** + * Sets the number of concurrent tasks that can be run at any given time on the TaskWorker + * @default 10 + */ + concurrentTasksLimit?: number; taskBroker?: TaskBroker; additionalTemplateFilters?: Record; additionalTemplateGlobals?: Record; @@ -160,6 +169,7 @@ export async function createRouter( catalogClient, actions, taskWorkers, + concurrentTasksLimit, scheduler, additionalTemplateFilters, additionalTemplateGlobals, @@ -211,6 +221,7 @@ export async function createRouter( workingDirectory, additionalTemplateFilters, additionalTemplateGlobals, + concurrentTasksLimit, }); workers.push(worker); }