Reputation: 2781
Laravel Task Scheduling has options like, everyMinute()
which will run a command every minute. I want to know what is the time it actually starts executing. Is it when I run the server or any specific second of the minute?
I am trying to run a function depending on the time difference. Here's a pseudocode
Run myCustomFunction() if diffInMin(now, customTime) <= 1
I thought it will run 1 time but it ran twice every time.
Upvotes: 0
Views: 583
Reputation: 2730
The scheduler usually runs every minute right around the zero secound mark based on the server's current time as @apokryfos mentioned.
Assuming the customTime
is a fixed DateTime, what makes you think the code you wrote will only run once?
now() === customTime
the diffInMin()
would be zero so the
condition diffInMin(now, customTime) <= 1
will evaluate to true.diffInMin()
would be 1, so the
condition diffInMin(now, customTime) <= 1
will still evaluate to true.Upvotes: 1