pulse icon indicating copy to clipboard operation
pulse copied to clipboard

Invalid endDate parameter

Open bili-jing opened this issue 1 year ago • 1 comments

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 avatar Nov 26 '24 12:11 bili-jing

개인적인 사정으로 인해 프로젝트 관리에 어려움을 겪었습니다. 이번 달부터 점진적으로 프로젝트 관리를 재개할 계획입니다.

code-xhyun avatar Apr 14 '25 08:04 code-xhyun