change name of task worker builder function

also makes it async

Signed-off-by: Brian Fletcher <brian@roadie.io>
This commit is contained in:
Brian Fletcher
2021-10-27 12:46:47 +01:00
parent 2223b6de60
commit 3236071136
3 changed files with 5 additions and 5 deletions
@@ -82,7 +82,7 @@ describe('TaskWorker', () => {
it('should call the legacy workflow runner when the apiVersion is not beta3', async () => {
const broker = new StorageTaskBroker(storage, logger);
const taskWorker = TaskWorker.createWorker({
const taskWorker = TaskWorker.create({
logger,
workingDirectory,
integrations,
@@ -113,7 +113,7 @@ describe('TaskWorker', () => {
it('should call the default workflow runner when the apiVersion is beta3', async () => {
const broker = new StorageTaskBroker(storage, logger);
const taskWorker = TaskWorker.createWorker({
const taskWorker = TaskWorker.create({
logger,
workingDirectory,
integrations,
@@ -142,7 +142,7 @@ describe('TaskWorker', () => {
});
const broker = new StorageTaskBroker(storage, logger);
const taskWorker = TaskWorker.createWorker({
const taskWorker = TaskWorker.create({
logger,
workingDirectory,
integrations,
@@ -56,7 +56,7 @@ export type CreateWorkerOptions = {
export class TaskWorker {
private constructor(private readonly options: TaskWorkerOptions) {}
static createWorker(options: CreateWorkerOptions) {
static async create(options: CreateWorkerOptions): Promise<TaskWorker> {
const {
taskBroker,
logger,
@@ -99,7 +99,7 @@ export async function createRouter(
const workers = [];
for (let i = 0; i < (taskWorkers || 1); i++) {
const worker = TaskWorker.createWorker({
const worker = await TaskWorker.create({
taskBroker,
actionRegistry,
integrations,