Comments (14)
Okay, thank you for your time.
I'll check that for sure.
Seems like it's a bug of another system :)
from croner.
Could it be because u had earlier installed node- cron and then u installed cronner
I am having similar issue
from croner.
Interesting! Could you please do a console.log beside checkForNewReviews, like
() => {
console.log(new Date().getTime());
checkForNewReviews();
}
To get a better view of whats going on?
from croner.
Here you are:
1641157690002
1641157690005
[2022-01-02 13:08:13.541] http: POST /api/reviews/update (3514 ms) 200
[2022-01-02 13:08:14.974] http: POST /api/reviews/update (4917 ms) 200
1641157750000
1641157750000
[2022-01-02 13:09:14.773] http: POST /api/reviews/update (4765 ms) 200
[2022-01-02 13:09:17.014] http: POST /api/reviews/update (7003 ms) 200
1641157810001
1641157810001
[2022-01-02 13:10:15.568] http: POST /api/reviews/update (5560 ms) 200
[2022-01-02 13:10:32.324] http: POST /api/reviews/update (22312 ms) 200
Also a question, does it supposed to run it every 10 seconds? ('10 * * * * *')
from croner.
Seems like you accidentally trigger the scheduling twice, maybe by including the triggering file twice? Croner really should not be able to make duplicate runs like that :)
Yes, if you use six part notation (10 * * * * *) the first part sets seconds, if you use five parts (10 * * * *) the first part sets minutes.
Edit: If you pass { maxRuns: 1 } as the second parameter to Cron, and your function as third parameter, do it run once or twice?
Edit2: If you make a console.log(new Date().getTime()
just before Cron(...), do you see the log once or twice?
from croner.
I have already tried three different cron packages (croner, node-cron, node-scheduler), the same problem exists for all of them.
from croner.
So, with this configuration it runs every minute ('10 * * * * *').
This is really strange.
This is the exact output I got with console.log(new Date().getTime():
1641158410001
1641158410001
[2022-01-02 13:20:13.783] http: POST /api/reviews/update (3758 ms) 200
[2022-01-02 13:20:14.496] http: POST /api/reviews/update (4440 ms) 200
1641158470002
1641158470001
[2022-01-02 13:21:14.936] http: POST /api/reviews/update (4927 ms) 200
[2022-01-02 13:21:15.658] http: POST /api/reviews/update (5646 ms) 200
I removed all the cache and still the problem exists.
from croner.
See my edited comments for pointers, your pattern is supposed to run at "second 10" once every minute, */10 * * * * * would run every tenth second
from croner.
Did the output of your last comments come from putting console.log outside the triggered function? Like
console.log(new Date...);
const job = Cron(...);
from croner.
Nope, this is my exact code:
const checkForNewReviews = require("./functions/checkForNewReviews");
var Cron = require("croner");
const job = Cron("*/10 * * * * *", () => {
console.log(new Date().getTime());
});
PS: now it runs every 10 seconds, but still got console.log(date) duplicates.
from croner.
Can you try this instead
const checkForNewReviews = require("./functions/checkForNewReviews");
var Cron = require("croner");
console.log(new Date().getTime());
const job = Cron("*/10 * * * * *", () => {});
And see if you get a duplicate log?
from croner.
from croner.
Ah, the code in backend/config/cron.js is run twice, for some reason
from croner.
No problem!
from croner.
Related Issues (20)
- Syntax error is service wroker HOT 2
- Cron runs every second instead of every 5 minutes. HOT 1
- Cron Job doesn't run correctly HOT 3
- L5,6 Day of the Week is not working correctly - L is not a number HOT 5
- Croner returns different values in case of trailing whitespace HOT 2
- Race HOT 4
- Fix and add the examples links HOT 1
- Request: Last day minus X HOT 1
- Bug: Increment not work as I expected HOT 3
- Specifying timezone causes no trigger using croner <= 7.x HOT 9
- previousRun and currentRun return null all the time HOT 5
- Using */59 * * * * * make run function twice HOT 1
- Support for modulo operator
- Specific timezones cause high CPU load on UNIX systems using croner <= 7.x HOT 10
- Storing job constant in mongo Db results in error HOT 1
- [Feature Request]: A way to stop all scheduled jobs, but wait for running jobs to complete HOT 2
- Job won't run when scheduled with America/Anchorage time zone HOT 1
- Events Feature request HOT 1
- Allow update HOT 1
- using utcOffset throws error: Invalid time zone specified HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from croner.