action-scheduler icon indicating copy to clipboard operation
action-scheduler copied to clipboard

Async actions make scheduled actions view very difficult to use

Open danielbitzer opened this issue 5 years ago • 5 comments
trafficstars

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.

danielbitzer avatar Sep 23 '20 02:09 danielbitzer

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.

thenbrent avatar Sep 23 '20 05:09 thenbrent

@danielbitzer A possible solution would be to update the scheduled date to the current time when the action completed.

rrennick avatar Sep 23 '20 12:09 rrennick

Related #567 (only mentioning for cross-referencing and future-reference, not a solution to the sorting problem).

crstauf avatar Sep 23 '20 17:09 crstauf

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".

danielbitzer avatar Sep 24 '20 01:09 danielbitzer

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.

rrennick avatar Sep 24 '20 12:09 rrennick

https://github.com/woocommerce/action-scheduler/pull/898 relates and may also resolve this one.

barryhughes avatar Dec 21 '22 22:12 barryhughes