deprecated taskWorkers option in RouterOption

Signed-off-by: Hao Luo <howlowck@gmail.com>
This commit is contained in:
Hao Luo
2022-10-28 17:27:21 -05:00
parent 5b00f413cd
commit 052226bd65
2 changed files with 14 additions and 4 deletions
+3 -4
View File
@@ -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({
@@ -67,7 +67,16 @@ export interface RouterOptions {
scheduler?: PluginTaskScheduler;
actions?: TemplateAction<any>[];
/**
* @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<string, TemplateFilter>;
additionalTemplateGlobals?: Record<string, TemplateGlobal>;
@@ -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);
}