diff --git a/api/controllers/v1/scheduled/index.ts b/api/controllers/v1/scheduled/index.ts index 67c362ca7..631efc3cd 100644 --- a/api/controllers/v1/scheduled/index.ts +++ b/api/controllers/v1/scheduled/index.ts @@ -3,9 +3,10 @@ import { options as docsLandingOptions } from './repos/docs-landing'; export const DeployDocsLanding = async () => { const { branches, repoName, repoOwner } = docsLandingOptions; - for (const branch of branches) { - await DeployRepo(repoOwner, repoName, branch) - } + Promise.all(branches.map(branch => { + return DeployRepo(repoOwner, repoName, branch) + }) + ) return { statusCode: 200, diff --git a/api/controllers/v1/scheduled/utils/index.ts b/api/controllers/v1/scheduled/utils/index.ts index de040e261..9e4d8cbeb 100644 --- a/api/controllers/v1/scheduled/utils/index.ts +++ b/api/controllers/v1/scheduled/utils/index.ts @@ -139,9 +139,9 @@ const getDeployableJobs = async (repoOwner:string , repoName:string , branchName async function deployRepo(deployable: Array, logger: ILogger, jobRepository: JobRepository, jobQueueUrl) { try { - await jobRepository.insertBulkJobs(deployable, jobQueueUrl); + return jobRepository.insertBulkJobs(deployable, jobQueueUrl); } catch (err) { - logger.error('deployRepo', err);x + logger.error('deployRepo', err); } } @@ -155,6 +155,6 @@ export const DeployRepo = async (repoOwner, repoName, branchName): Promise const deployable = await getDeployableJobs(repoOwner, repoName, branchName, branchRepository); if (deployable.length > 0) { - await deployRepo(deployable, consoleLogger, jobRepository, c.get('jobsQueueUrl')); + return deployRepo(deployable, consoleLogger, jobRepository, c.get('jobsQueueUrl')); } }; \ No newline at end of file