action-scheduler
action-scheduler copied to clipboard
Async actions make scheduled actions view very difficult to use
Async actions are scheduled for the datetime 0000-00-00 00:00:00 and it appears that the Scheduled Actions table is sorted by Scheduled date. When debugging scheduled actions or generally working with them it's important to be able view actions by date. The problem is that async actions can't be sorted by date in the scheduled actions view.
One possible (albeit hacky) solution would be to schedule async actions for one second in the past rather than 0000-00-00 00:00:00.
One possible (albeit hacky) solution would be to schedule async actions for one second in the past rather than 0000-00-00 00:00:00.
The reason we didn't do that initially was to make sure async actions were always processed before scheduled actions. We could achieve the same thing by using the Unix epoch time though.
With all the zero date issues that have come up, perhaps that's what async actions should use for their scheduled date. I personally wish I did that initially to save folks the hassles of those zero date issues.
@danielbitzer A possible solution would be to update the scheduled date to the current time when the action completed.
Related #567 (only mentioning for cross-referencing and future-reference, not a solution to the sorting problem).
The reason we didn't do that initially was to make sure async actions were always processed before scheduled actions.
That makes sense. With AutomateWoo batch processing I'm wanting to schedule actions to run immediately but they don't need to take priority over any other actions so I think we'll just schedule them for 1 second ago.
With all the zero date issues that have come up, perhaps that's what async actions should use for their scheduled date. I personally wish I did that initially to save folks the hassles of those zero date issues.
I'm not aware of the zero date issues but one possible solution could be marking time-sensitive actions as high priority. Those actions could be run before all others. In the case of AW batch processing most of the actions I'm scheduling I'm wanting to run now but they don't really need to take precedence over subscription renewals for example. Essentially process these items as soon as you can but not before any critical store events.
A possible solution would be to update the scheduled date to the current time when the action completed.
I'm not sure what the best solution for the table view is but another possibility would be to have a sort column for "Date action was processed" as well as "Scheduled date".
another possibility would be to have a sort column for "Date action was processed" as well as "Scheduled date".
We could add the Last Attempt date as a column.
https://github.com/woocommerce/action-scheduler/pull/898 relates and may also resolve this one.