Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Job Launcher - Reputation Oracle - Make cron jobs compatible with Vercel and GCP #1287

Merged
merged 6 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export class JobController {
@Get('pending/:chainId/:workerAddress')
getPendingJobs(
@Param('chainId') chainId: number,
@Param('workerAddress') escrowAddress: string,
@Param('workerAddress') workerAddress: string,
): Promise<any> {
return this.jobService.getPendingJobs(chainId, escrowAddress);
return this.jobService.getPendingJobs(chainId, workerAddress);
}

@Post('solve')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export class JobController {
@Public()
@Get('/cron/launch')
public async launchCronJob(): Promise<any> {
this.jobService.launchCronJob();
await this.jobService.launchCronJob();
return;
}

Expand All @@ -107,7 +107,7 @@ export class JobController {
@Public()
@Get('/cron/cancel')
public async cancelCronJob(): Promise<any> {
this.jobService.cancelCronJob();
await this.jobService.cancelCronJob();
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ export class JobService {
waitUntil: SortDirection.ASC,
},
},
);
);

if (!jobEntity) return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ export class WebhookController {
@Public()
@Get('/cron/pending')
public async processPendingCronJob(): Promise<any> {
this.webhookService.processPendingCronJob();
await this.webhookService.processPendingCronJob();
return;
}

@Public()
@Get('/cron/paid')
public async processPaidCronJob(): Promise<any> {
this.webhookService.processPaidCronJob();
await this.webhookService.processPaidCronJob();
return;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ export class WebhookService {
}
}

@Cron(CronExpression.EVERY_10_MINUTES)
/**
* Processes a pending webhook. Validates and processes incoming data,
* then sends payments based on the processing results.
* @param webhookEntity The entity representing the webhook data.
* @throws {Error} Will throw an error if processing fails at any step.
*/
@Cron(CronExpression.EVERY_10_MINUTES)
public async processPendingCronJob(): Promise<boolean> {
this.logger.log('Pending webhooks START');
const webhookEntity = await this.webhookRepository.findOne(
Expand Down Expand Up @@ -363,12 +363,12 @@ export class WebhookService {
return intermediateResults;
}

@Cron(CronExpression.EVERY_10_MINUTES)
/**
* Processing a webhook of an entity with a paid status.
* @returns {Promise<boolean>} - Return the boolean result of the method.
* @throws {Error} - An error object if an error occurred.
*/
@Cron(CronExpression.EVERY_10_MINUTES)
public async processPaidCronJob(): Promise<boolean> {
this.logger.log('Paid jobs START');
const webhookEntity = await this.webhookRepository.findOne(
Expand Down
Loading