diff --git a/packages/apps/job-launcher/server/src/modules/webhook/webhook.controller.ts b/packages/apps/job-launcher/server/src/modules/webhook/webhook.controller.ts index 2ad54457d5..618873ad99 100644 --- a/packages/apps/job-launcher/server/src/modules/webhook/webhook.controller.ts +++ b/packages/apps/job-launcher/server/src/modules/webhook/webhook.controller.ts @@ -9,9 +9,9 @@ import { WebhookService } from './webhook.service'; export class WebhookController { constructor(private readonly webhookService: WebhookService) {} @Public() - @Get('/cron/launch') - public async processPendingCronJob(): Promise { - await this.webhookService.processPendingCronJob(); + @Get('/cron') + public async processPendingWebhooks(): Promise { + await this.webhookService.processPendingWebhooks(); return; } } diff --git a/packages/apps/job-launcher/server/src/modules/webhook/webhook.service.spec.ts b/packages/apps/job-launcher/server/src/modules/webhook/webhook.service.spec.ts index d53bf8b5f9..45ab102464 100644 --- a/packages/apps/job-launcher/server/src/modules/webhook/webhook.service.spec.ts +++ b/packages/apps/job-launcher/server/src/modules/webhook/webhook.service.spec.ts @@ -344,7 +344,7 @@ describe('WebhookService', () => { const startCronJobMock = jest.spyOn(cronJobService, 'startCronJob'); - await (webhookService as any).processPendingCronJob(); + await (webhookService as any).processPendingWebhooks(); expect(startCronJobMock).not.toHaveBeenCalled(); }); @@ -354,7 +354,7 @@ describe('WebhookService', () => { .spyOn(cronJobService, 'startCronJob') .mockResolvedValueOnce(cronJobEntityMock as any); - await (webhookService as any).processPendingCronJob(); + await (webhookService as any).processPendingWebhooks(); expect(cronJobService.startCronJob).toHaveBeenCalledWith( CronJobType.ProcessPendingWebhook, @@ -362,7 +362,7 @@ describe('WebhookService', () => { }); it('should send webhook for all of the pending webhooks', async () => { - await (webhookService as any).processPendingCronJob(); + await (webhookService as any).processPendingWebhooks(); expect(sendWebhookMock).toHaveBeenCalledTimes(2); expect(sendWebhookMock).toHaveBeenCalledWith(webhookEntity1); @@ -382,7 +382,7 @@ describe('WebhookService', () => { it('should increase retriesCount by 1 if sending webhook fails', async () => { sendWebhookMock.mockRejectedValueOnce(new Error()); - await (webhookService as any).processPendingCronJob(); + await (webhookService as any).processPendingWebhooks(); expect(webhookRepository.updateOne).toHaveBeenCalledWith( { id: webhookEntity1.id }, @@ -398,7 +398,7 @@ describe('WebhookService', () => { webhookEntity1.retriesCount = MOCK_MAX_RETRY_COUNT; - await (webhookService as any).processPendingCronJob(); + await (webhookService as any).processPendingWebhooks(); expect(webhookRepository.updateOne).toHaveBeenCalledWith( { id: webhookEntity1.id }, @@ -411,7 +411,7 @@ describe('WebhookService', () => { .spyOn(cronJobService, 'completeCronJob') .mockResolvedValueOnce(cronJobEntityMock as any); - await (webhookService as any).processPendingCronJob(); + await (webhookService as any).processPendingWebhooks(); expect(cronJobService.completeCronJob).toHaveBeenCalledWith( cronJobEntityMock as any, diff --git a/packages/apps/job-launcher/server/src/modules/webhook/webhook.service.ts b/packages/apps/job-launcher/server/src/modules/webhook/webhook.service.ts index dbb38febe8..607a298b8f 100644 --- a/packages/apps/job-launcher/server/src/modules/webhook/webhook.service.ts +++ b/packages/apps/job-launcher/server/src/modules/webhook/webhook.service.ts @@ -160,7 +160,7 @@ export class WebhookService { * @returns {Promise} - Returns a promise that resolves when the operation is complete. */ @Cron(CronExpression.EVERY_10_MINUTES) - public async processPendingCronJob(): Promise { + public async processPendingWebhooks(): Promise { const isCronJobRunning = await this.cronJobService.isCronJobRunning( CronJobType.ProcessPendingWebhook, ); diff --git a/packages/apps/job-launcher/server/vercel.json b/packages/apps/job-launcher/server/vercel.json index db11d9fdd8..a43e293568 100644 --- a/packages/apps/job-launcher/server/vercel.json +++ b/packages/apps/job-launcher/server/vercel.json @@ -19,12 +19,24 @@ ], "crons": [ { - "path": "/job/cron/launch", - "schedule": "*/1 * * * *" + "path": "/job/cron/create-escrow", + "schedule": "*/10 * * * *" + }, + { + "path": "/job/cron/setup-escrow", + "schedule": "*/10 * * * *" + }, + { + "path": "/job/cron/fund-escrow", + "schedule": "*/10 * * * *" }, { "path": "/job/cron/cancel", - "schedule": "*/1 * * * *" + "schedule": "*/10 * * * *" + }, + { + "path": "/webhook/cron", + "schedule": "*/10 * * * *" } ], "ignoreCommand": "git diff HEAD^ HEAD --quiet ."