<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: dhil rohith</title>
    <description>The latest articles on DEV Community by dhil rohith (@dhil_rohith_ec2e0e9793ea6).</description>
    <link>https://dev.to/dhil_rohith_ec2e0e9793ea6</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3459675%2Fa27b40b6-f71f-44c0-b846-fec3e39e8d0b.png</url>
      <title>DEV Community: dhil rohith</title>
      <link>https://dev.to/dhil_rohith_ec2e0e9793ea6</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dhil_rohith_ec2e0e9793ea6"/>
    <language>en</language>
    <item>
      <title>NestJS @Cron jobs stop firing when app runs as Windows service</title>
      <dc:creator>dhil rohith</dc:creator>
      <pubDate>Tue, 26 Aug 2025 07:57:33 +0000</pubDate>
      <link>https://dev.to/dhil_rohith_ec2e0e9793ea6/nestjs-cron-jobs-stop-firing-when-app-runs-as-windows-service-49k0</link>
      <guid>https://dev.to/dhil_rohith_ec2e0e9793ea6/nestjs-cron-jobs-stop-firing-when-app-runs-as-windows-service-49k0</guid>
      <description>&lt;p&gt;I have a NestJS application running on a Windows Server, where the app is installed as a Windows Service (via nssm).&lt;/p&gt;

&lt;p&gt;Inside the app I use @nestjs/schedule with 5 cron jobs:&lt;/p&gt;

&lt;p&gt;one runs every 1 minute&lt;/p&gt;

&lt;p&gt;one runs every 5 minutes&lt;/p&gt;

&lt;p&gt;others run every 10 min, 15 min, 1 hour, etc.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;Example code for the 5-minute job:&lt;/p&gt;

&lt;p&gt;import { Cron } from '@nestjs/schedule';&lt;br&gt;
import { Injectable, Logger } from '@nestjs/common';&lt;/p&gt;

&lt;p&gt;@Injectable()&lt;br&gt;
export class TasksService {&lt;br&gt;
  private readonly logger = new Logger(TasksService.name);&lt;/p&gt;

&lt;p&gt;&lt;a class="mentioned-user" href="https://dev.to/cron"&gt;@cron&lt;/a&gt;('*/5 * * * *')&lt;br&gt;
  async scheduledHandleCronOld() {&lt;br&gt;
    this.logger.log('Old File Processing Job &amp;gt;&amp;gt; Starting scheduled handleCronOld...');&lt;br&gt;
    try {&lt;br&gt;
      if (this.config.get('SFTP_FILE_FORMAT') === 'OLD') {&lt;br&gt;
        await this.handleCronOld(null);&lt;br&gt;
      } else {&lt;br&gt;
        this.logger.log('Old File Processing Job &amp;gt;&amp;gt; Ended due to config is NEW File Format...');&lt;br&gt;
      }&lt;br&gt;
    } catch (error) {&lt;br&gt;
      this.logger.error(&lt;code&gt;Old File Processing Job &amp;gt;&amp;gt; Scheduler error: ${error.message}&lt;/code&gt;);&lt;br&gt;
    }&lt;br&gt;
  }&lt;br&gt;
}&lt;/p&gt;

</description>
      <category>node</category>
      <category>nestjs</category>
      <category>scheduler</category>
      <category>programming</category>
    </item>
    <item>
      <title>NestJS cron scheduler stops running silently when app is hosted as Windows Service</title>
      <dc:creator>dhil rohith</dc:creator>
      <pubDate>Tue, 26 Aug 2025 07:13:12 +0000</pubDate>
      <link>https://dev.to/dhil_rohith_ec2e0e9793ea6/nestjs-cron-scheduler-stops-running-silently-when-app-is-hosted-as-windows-service-1gbd</link>
      <guid>https://dev.to/dhil_rohith_ec2e0e9793ea6/nestjs-cron-scheduler-stops-running-silently-when-app-is-hosted-as-windows-service-1gbd</guid>
      <description>&lt;p&gt;Hey everyone,&lt;/p&gt;

&lt;p&gt;I’m running a NestJS application as a Windows service on a Windows server.&lt;br&gt;
Inside this service (named sftp), I have 5 cron schedulers configured. Each runs at different intervals (e.g., every 1 minute, every 5 minutes, etc.).&lt;/p&gt;

&lt;p&gt;The issue I’m facing:&lt;/p&gt;

&lt;p&gt;The 1-minute scheduler and 5-minute scheduler stop running unexpectedly.&lt;/p&gt;

&lt;p&gt;The service itself is still up and running, and the other schedulers continue working fine.&lt;/p&gt;

&lt;p&gt;From the logs, I can see that the job starts and completes normally (including successful disconnect).&lt;/p&gt;

&lt;p&gt;Normally, the scheduler should fire again in the next cycle, but it never does.&lt;/p&gt;

&lt;p&gt;No errors are logged, no suspicious behavior before it stops, and processing time is normal.&lt;/p&gt;

&lt;p&gt;I already have error handling in place, so it doesn’t look like it’s silently failing.&lt;/p&gt;

&lt;p&gt;Has anyone else experienced a scheduler just stopping without errors while the rest of the app continues?&lt;br&gt;
Any ideas on what could cause this or how to debug further would be really helpful.&lt;/p&gt;

&lt;p&gt;Logs (just before it stopped running):&lt;/p&gt;

&lt;p&gt;[2025-08-20 14:30:00] [SftpOldService] INFO: Old File Processing Job &amp;gt;&amp;gt; Starting scheduled handleCronOld... | Host: SN2EBYX1C0032, PID: 24325&lt;br&gt;
[2025-08-20 14:30:00] [SftpOldService] INFO: Old File Processing Job &amp;gt;&amp;gt;  Started  | Host: SN2EBYX1C0032, PID: 20456&lt;br&gt;
[2025-08-20 14:30:00] [SftpOldService] INFO: Old File Processing Job &amp;gt;&amp;gt;  Started with config: &lt;br&gt;
            Host: 123.227.7.73&lt;br&gt;
            Port: 22&lt;br&gt;
            Username: xxxyyy&lt;br&gt;
            Path: /mh | Host: SN2EBYX1C0032, PID: 24325&lt;/p&gt;

&lt;p&gt;[2025-08-20 14:30:00] [SftpOldService] INFO: SFTP Connected successfully to 123.227.7.73 | Host: SN2EBYX1C0032, PID: 24325&lt;br&gt;
[2025-08-20 14:30:00] [SftpOldService] INFO: Old File Processing Job &amp;gt;&amp;gt; SFTP CONNECTED | Host: SN2EBYX1C0032, PID: 24325&lt;br&gt;
[2025-08-20 14:30:00] [SftpOldService] DEBUG: Old File Processing Job &amp;gt;&amp;gt; Files in directory /mh:  | Host: SN2EBYX1C0032, PID: 24325&lt;br&gt;
[2025-08-20 14:30:00] [SftpOldService] INFO: Old File Processing Job &amp;gt;&amp;gt; No CSV files found in SFTP directory | Host: SN2EBYX1C0032, PID: 24325&lt;br&gt;
[2025-08-20 14:30:00] [SftpOldService] INFO: SFTP disconnected successfully | Host:SN2EBYX1C0032, PID:24325&lt;/p&gt;

</description>
      <category>nestjs</category>
      <category>node</category>
      <category>cron</category>
      <category>windows</category>
    </item>
  </channel>
</rss>
