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

One cron is blocking another #3

Closed
AlariCode opened this issue Sep 7, 2018 · 2 comments
Closed

One cron is blocking another #3

AlariCode opened this issue Sep 7, 2018 · 2 comments

Comments

@AlariCode
Copy link

In one of my microservices I have two modules with one @Cron in each of them:

// FeedModule
export class FeedService extends NestSchedule {
    // ...
    @Cron('00 30 6 * * *')
    async runCron() { ... }
}

// ArrivalModule
export class ArrivalService extends NestSchedule {
    // ...
    @Cron('* * * * *')
    async runCron() { ... }
}

ArrivalService check new data every minute. And when at 6:30 am FeedService tries to do it's job, it fails, because process is busy with ArrivalService job. What can you suggest? Thank you!

@miaowing
Copy link
Owner

I publish a new version @0.4.0, it supports retry, maybe can help you.

import { Cron } from 'nest-schedule';

export class FeedService extends NestSchedule {

    // It will retry after 5s when throw an error.
    @Cron('00 30 6 * * *', {maxRetry: 1, retryInterval: 5000})
    async runCron() { ... }
}

@AlariCode
Copy link
Author

Thank you! I'll try it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants