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

Cron job triggering whenever it wants #918

Closed
RealKHFan opened this issue Nov 13, 2024 · 9 comments
Closed

Cron job triggering whenever it wants #918

RealKHFan opened this issue Nov 13, 2024 · 9 comments

Comments

@RealKHFan
Copy link

Description

I want my cron job to trigger on a Tuesday every week at 6pm, for that I created a new cronjob that does that, but it triggers whenever it wants, I tried different methods in usage but it still doesn't trigger on the time I want it to trigger.
Note: after 10 weeks it triggered yesterday at 6pm 12/11/2024
Here is the code:
code
Note that the code within my EventHandler is not the one which doesn't execute, I tried on my system before.

The system on which the discord bot is at is ubuntu

cron job version: 2.4.0

Expected Behavior

execute at 6pm on every week on a Tuesday

Actual Behavior

executes on a Sunday, Monday, Thursday, Friday at different times like 22:54, 20:32, 17:56 and some other times

Possible Fix

I am not sure why it occurs

Steps to Reproduce

use the same code and change the event handler to a console.log or something else

Context

I want my users to get notified at 6pm on a Tuesday every week

Your Environment

  • cron version: 2.4.0
  • NodeJS version:18.16.1
  • Operating System and version:Windows for PC and Ubuntu for the command which doesn't trigger
  • TypeScript version (if applicable):none
  • Link to your project (if applicable):private repo
    all dependencies
@RealKHFan RealKHFan changed the title Cron job triggering whenever it want Cron job triggering whenever it wants Nov 13, 2024
@sheerlox
Copy link
Collaborator

Hi,

Thank you for raising this issue and providing detailed information. I've created a minimal reproduction repository for this case to verify whether cron is behaving as expected. The purpose of this repository is to simulate a cron job accurately with a schedule that triggers every Tuesday at 6 PM UTC.

Results from the Tests

After running multiple tests through this repo, the behavior you mentioned does not arise:

  • The cron job consistently triggers at 6 PM UTC every Tuesday (as intended).
  • The job does not trigger at any incorrect times, like Sunday, Monday, or any other unintended day.

You can find the reproduction repository here:
👉 GitHub repo: cron-reproductions/918

I recommend pulling down the minimal reproduction repository and trying it within your environment directly.

If the issue persists or if you notice any anomalies while testing it in isolation, please share the findings and we’ll dig deeper.

@RealKHFan
Copy link
Author

Thank you for reproducing my issue. I will compare the data from my repository to yours.

@RealKHFan
Copy link
Author

Has it been tested on Ubuntu as well?
Because the code that I showed gets executed on Windows for me

@RealKHFan
Copy link
Author

The Test works on my machine as well but again, its Windows, not Ubuntu

@sheerlox
Copy link
Collaborator

Has it been tested on Ubuntu as well? Because the code that I showed gets executed on Windows for me

Yes, I'm working on Ubuntu!

@RealKHFan
Copy link
Author

Has it been tested on Ubuntu as well? Because the code that I showed gets executed on Windows for me

Yes, I'm working on Ubuntu!

I will be testing it on my machine and I will give you feedback if it triggered consistently

@RealKHFan
Copy link
Author

Hi, last week my server crashed and I had nothing to report, this week it was executed at 6 pm on Tuesday, if it will trigger next week at the same time then I will give you feedback and close this ticket!

@RealKHFan
Copy link
Author

I tested it directly on my VM Linux Machine and the tests passed, I will keep an eye on it as well

@intcreator intcreator added the type:bug Bug reports and bug fixes label Dec 11, 2024
@sheerlox sheerlox removed the type:bug Bug reports and bug fixes label Dec 25, 2024
@sheerlox
Copy link
Collaborator

Closing for stale, feel free to reopen with more detail if this keeps occurring :)

@sheerlox sheerlox closed this as not planned Won't fix, can't repro, duplicate, stale Dec 25, 2024
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

3 participants