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

Recurring Job keeps running even if schedule is removed #2448

Open
minajevs opened this issue Jan 10, 2025 · 0 comments
Open

Recurring Job keeps running even if schedule is removed #2448

minajevs opened this issue Jan 10, 2025 · 0 comments

Comments

@minajevs
Copy link

Describe the bug
Removing schedule from a Recurring Job doesn't stop it from running. When schedule is removed from wasp file, it is not removed from pgBoss.

To Reproduce
Steps to reproduce the behavior:

  1. Create a basic Job without schedule:
job sampleJob {
  executor: PgBoss,
  perform: {
    fn: import sampleJob from "@src/sampleJob"
  }
}
import { type SampleJob } from "wasp/server/jobs";
export const sampleJob: SampleJob<never, void> = async () => {
  console.log(new Date(), "Running sample job")
}
export default sampleJob
  1. Add schedule to the Job to make it recurring, i.e.:
job sampleJob {
  executor: PgBoss,
  perform: {
    fn: import sampleJob from "@src/sampleJob"
  },
  schedule: {
    cron: "* * * * *"
  }
}

Save wasp file, verify job is running, verify schedule is created in pgBoss:
Image

  1. Remove schedule from the job in wasp file
job sampleJob {
  executor: PgBoss,
  perform: {
    fn: import sampleJob from "@src/sampleJob"
  },
  //schedule: {
  //  cron: "* * * * *"
  //}
}

Save wasp file. Restart wasp compiler for the good measure.

Observed behavior
Job continues to run every minute. Schedule is not removed from pgBoss:
Image

Expected behavior
I would expect job to stop running because it no longer has schedule.

Environment
Node.js v22.11.0
Wasp 15.0

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

1 participant