I have a NestJS application running on a Windows Server, where the app is installed as a Windows Service (via nssm).
Inside the app I use @nestjs/schedule with 5 cron jobs:
one runs every 1 minute
one runs every 5 minutes
others run every 10 min, 15 min, 1 hour, etc.
The issue: the 1-minute and 5-minute jobs stop firing after some time, but the rest continue normally. The service itself remains running, and there are no error logs.
Example code for the 5-minute job:
import { Cron } from '@nestjs/schedule';
import { Injectable, Logger } from '@nestjs/common';
@Injectable()
export class TasksService {
private readonly logger = new Logger(TasksService.name);
@cron('*/5 * * * *')
async scheduledHandleCronOld() {
this.logger.log('Old File Processing Job >> Starting scheduled handleCronOld...');
try {
if (this.config.get('SFTP_FILE_FORMAT') === 'OLD') {
await this.handleCronOld(null);
} else {
this.logger.log('Old File Processing Job >> Ended due to config is NEW File Format...');
}
} catch (error) {
this.logger.error(Old File Processing Job >> Scheduler error: ${error.message}
);
}
}
}
Top comments (0)