Comments (6)
Actually, there might be a solution (note that I use "might" and not "there's a solution"
- When retrieving tasks using
getDueTasks()
, we can filter the results usinglast_execution
option, this one is set using aDatetimeImmutable
each time that the task is executed.
Maybe that we can do something like this:
Given the current date (using a specific format)
When I retrieve the due tasks
And that I filter each one using CronExpression()->isDue()
And that I check if the current date (close to the current minute) does not equal the last execution of the task
Then I should find a set of tasks (or none if tasks have already been executed
WDYT?
from schedulerbundle.
after search, it is a limit of the cron-expression parser, the isDue()
method does not take seconds into account.
/**
* Determine if the cron is due to run based on the current date or a
* specific date. This method assumes that the current number of
* seconds are irrelevant, and should be called once per minute.
*
* @param string|\DateTimeInterface $currentTime Relative calculation date
* @param null|string $timeZone TimeZone to use instead of the system default
*
* @return bool Returns TRUE if the cron is due to run or FALSE if not
*/
So, when I run several scheduler:consume
in the same minute the task is executed each time.
(and should be called once per minute)
Is it a problem ? do we need to add a check for this ?
from schedulerbundle.
Hum, currently and apart from the scheduler:consume
command, I don't know how to bypass this limitation, maybe we can pause the worker (thanks to sleep
) until the next minute but the issue is located in the scheduler, not the worker.
Regarding the getDueTasks()
method, I don't know how to add a check in it, maybe via a flag (maybe hasBeenCalled
?) or an attribute but for me, the issue is related to the external library, not the bundle
from schedulerbundle.
yes i agree with you i don't see how to improve that. you can close this request if you wish
from schedulerbundle.
Hi @jvancoillie
I'm gonna merge the fix this morning, should be released in 0.4.5
from schedulerbundle.
great new ! will test this soon
from schedulerbundle.
Related Issues (20)
- Deprecated implicit conversion from float to int HOT 2
- Docrine transport might not work properly with Postresql HOT 7
- ci(tools): introducing Dagger
- bug(bridge): Rebooting the scheduler clears everything in the transport HOT 4
- Segmentation fault with the 0.9.0 tag HOT 8
- feat(command): add autocompletion
- bug: Update to SF6.1-RC leads to serialization type error on NotificationTaskBagNormalizer HOT 9
- build(sf): prepare for 7.0 HOT 1
- bug(bridge): postgres not working HOT 3
- bug(serializer): TraceableNormalizer usage HOT 3
- feat(bridge): Dragonfly bridge
- Fix deprecation warnings for Symfony 6.1 commands HOT 5
- bug(scheduler): tasks are always recreated HOT 1
- bug(worker): TaskInterface::setLastExecution() must be called even when an error occurs
- feat(command): Gracefully stopping the worker HOT 2
- bug(scheduler): regression on scheduler:reboot (0.9.4) HOT 5
- bug(transport): using Debug pack resulting "datetime normalizer" error HOT 9
- bug(command): scheduler:stop-worker not stopping when wait and force arguments present HOT 5
- Use of mutation testing in SchedulerBundle - Help needed
- Deprecations coming with Symfony 6.3
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 schedulerbundle.