You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For now, when we use bin/magento cronjobmanager:runjob, the scheduled task is saved to Magento database before being actually running.
This might cause a race condition in a production environment, if the native cron manager is triggered between schedule creation and schedule actual start from the CLI command.
I'd suggest 3 changes:
ScheduleManagement::createSchedule() should no longer save the created schedule to database: it should be caller's responsibility.
Update ScheduleManagement::execute() to take a Schedule object instead of a scheduled ID. This would allow the previous created object to be executed, without being saved. This suggestion make require some adaptation, as this method is a part of the WebAPI.
ScheduleManagement::execute() should set the Schedule Object State to Schedule::STATUS_RUNNING along setting the Executed At.
The text was updated successfully, but these errors were encountered:
kyriog
changed the title
Avoid saving runjob before actually running them
Avoid saving schedules before actually running them with runjobFeb 18, 2019
For now, when we use
bin/magento cronjobmanager:runjob
, the scheduled task is saved to Magento database before being actually running.This might cause a race condition in a production environment, if the native cron manager is triggered between schedule creation and schedule actual start from the CLI command.
I'd suggest 3 changes:
ScheduleManagement::createSchedule()
should no longer save the created schedule to database: it should be caller's responsibility.ScheduleManagement::execute()
to take aSchedule
object instead of a scheduled ID. This would allow the previous created object to be executed, without being saved. This suggestion make require some adaptation, as this method is a part of the WebAPI.ScheduleManagement::execute()
should set theSchedule
Object State toSchedule::STATUS_RUNNING
along setting the Executed At.The text was updated successfully, but these errors were encountered: