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

Invalid endDate parameter #67

Open
bili-jing opened this issue Nov 26, 2024 · 0 comments
Open

Invalid endDate parameter #67

bili-jing opened this issue Nov 26, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@bili-jing
Copy link

Description

When I use pulse.every, setting endDate has no effect. I set both startDate and endDate, but only startDate has an effect, and the task will continue to execute after the set endDate time has passed.

Code example

import Pulse from "@pulsecron/pulse";

const mongoConnectionString = '****';

const pulse = new Pulse({ db: { address: mongoConnectionString } });

pulse.define(
  "raintrip",
  async (job) => {
    console.log("raintrip job running");
    return;
  },
  {
    shouldSaveResult: true,
    attempts: 4,
    backoff: { type: "exponential", delay: 1000 },
  }
);

(async function () {
  // IIFE to give access to async/await
  await pulse.start();

  // Alternatively, you could also do:
  await pulse.every("* * * * *", "raintrip", {
    timezone: "Asia/Shanghai",
    startDate: new Date("2024-11-26T20:20:00"),
    endDate: new Date("2024-11-26T20:25:00"),
  });

Additional context

"@pulsecron/pulse": "^1.6.7"

@bili-jing bili-jing added the bug Something isn't working label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants