Skip to content

Commit

Permalink
DOP-4549 return early
Browse files Browse the repository at this point in the history
  • Loading branch information
anabellabuckvar committed Apr 18, 2024
1 parent 9265cd9 commit ecb6914
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions api/controllers/v1/slack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,19 @@ export const DeployRepo = async (event: any = {}): Promise<any> => {
}
const deployable = await getDeployableJobs(values, entitlement, repoBranchesRepository, docsetsRepository);
console.log(JSON.stringify(deployable));
return {
statusCode: 200,
headers: { 'Content-Type': 'application/json' },
body: 'success!',
};
if (deployable.length > 0) {
await deployRepo(deployable, consoleLogger, jobRepository, c.get('jobsQueueUrl'));
console.log('Repos have been deployed');
return {
statusCode: 200,
headers: { 'Content-Type': 'application/json' },
body: 'success!',
};
}
return {
statusCode: 200,
Expand Down
5 changes: 4 additions & 1 deletion src/repositories/jobRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ export class JobRepository extends BaseRepository {
throw new DBError('insertBulkJobs: Unable to insert multiple jobs');
}
// Insertion/re-enqueueing should be sent to jobs queue and updates for an existing job should be sent to jobUpdates Queue
this._logger.info('insertBulkJobs', `Total Jobs Expected : ${jobs.length}, Total Jobs Sent: ${jobIds.length}`);
this._logger.info(
'insertBulkJobs',
`Total Jobs Expected : ${jobs.length}, Jobs: ${JSON.stringify(jobIds)}, Total Jobs Sent: ${jobIds.length}`
);
await Promise.all(
Object.values(jobIds).map(async (jobId: string) => {
await this._queueConnector.sendMessage(new JobQueueMessage(jobId, JobStatus.inQueue), url, 0);
Expand Down

0 comments on commit ecb6914

Please sign in to comment.