Skip to content

Commit 441a607

Browse files
authored
fixes to avoid jl timeout, avoid skipping funding escrow and adjust cron expression (#1949)
1 parent 651ed44 commit 441a607

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

packages/apps/job-launcher/server/src/modules/cron-job/cron-job.service.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ export class CronJobService {
8484
const cronJob = await this.startCronJob(CronJobType.CreateEscrow);
8585

8686
try {
87-
const jobEntities = await this.jobRepository.findByStatus(JobStatus.PAID);
87+
const jobEntities = await this.jobRepository.findByStatus(
88+
JobStatus.PAID,
89+
3,
90+
);
8891
for (const jobEntity of jobEntities) {
8992
try {
9093
await this.jobService.createEscrow(jobEntity);
@@ -116,6 +119,7 @@ export class CronJobService {
116119
try {
117120
const jobEntities = await this.jobRepository.findByStatus(
118121
JobStatus.CREATED,
122+
3,
119123
);
120124

121125
for (const jobEntity of jobEntities) {
@@ -149,6 +153,7 @@ export class CronJobService {
149153
try {
150154
const jobEntities = await this.jobRepository.findByStatus(
151155
JobStatus.SET_UP,
156+
3,
152157
);
153158

154159
for (const jobEntity of jobEntities) {
@@ -182,6 +187,7 @@ export class CronJobService {
182187
try {
183188
const jobEntities = await this.jobRepository.findByStatus(
184189
JobStatus.TO_CANCEL,
190+
3,
185191
);
186192

187193
for (const jobEntity of jobEntities) {

packages/apps/job-launcher/server/src/modules/job/job.repository.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ export class JobRepository extends BaseRepository<JobEntity> {
4040
});
4141
}
4242

43-
public async findByStatus(status: JobStatus): Promise<JobEntity[]> {
43+
public async findByStatus(
44+
status: JobStatus,
45+
take?: number,
46+
): Promise<JobEntity[]> {
4447
return this.find({
4548
where: {
4649
status: status,
@@ -51,6 +54,7 @@ export class JobRepository extends BaseRepository<JobEntity> {
5154
createdAt: SortDirection.DESC,
5255
waitUntil: SortDirection.ASC,
5356
},
57+
...(take && { take }),
5458
});
5559
}
5660

packages/apps/job-launcher/server/vercel.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,23 @@
5555
"crons": [
5656
{
5757
"path": "/cron/escrow/create",
58-
"schedule": "*/5 * * * *"
58+
"schedule": "*/2 * * * *"
5959
},
6060
{
6161
"path": "/cron/escrow/setup",
62-
"schedule": "*/5 * * * *"
62+
"schedule": "1-59/2 * * * *"
6363
},
6464
{
6565
"path": "/cron/escrow/fund",
66-
"schedule": "*/5 * * * *"
66+
"schedule": "*/2 * * * *"
6767
},
6868
{
6969
"path": "/cron/escrow/cancel",
7070
"schedule": "*/5 * * * *"
7171
},
7272
{
7373
"path": "/cron/webhook/process",
74-
"schedule": "*/5 * * * *"
74+
"schedule": "*/3 * * * *"
7575
}
7676
],
7777
"headers": [

packages/sdk/typescript/human-protocol-sdk/src/escrow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ export class EscrowClient extends BaseEthersClient {
486486
);
487487
await (
488488
await tokenContract.transfer(escrowAddress, amount, txOptions)
489-
).wait;
489+
).wait();
490490

491491
return;
492492
} catch (e) {

0 commit comments

Comments
 (0)