Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scheduling an action fails quite bad when AS tables are missing #856

Closed
jorgeatorres opened this issue Sep 15, 2022 · 4 comments
Closed
Labels
priority: normal The issue/PR is normal priority—not many people are affected or there’s a workaround, etc. type: enhancement The issue is a request for an enhancement.

Comments

@jorgeatorres
Copy link
Member

Related to woocommerce/woocommerce#34497, when AS tables are missing, as_schedule_recurring_action() throws a fatal exception.
This could make it impossible to get to WooCommerce > Status > Action Scheduler, where the tables can be effectively regenerated.

This isn't incorrect in itself and WC could do a better job at capturing and handling these exceptions, but maybe AS could attempt to re-generate those tables "on the fly" or at least fail to report it has been fully initialized when scheduling an action will result in a fatal error.
This might be tricky due to the data-store-agnostic way things work, but maybe something we can explore in the future.

To reproduce:

  1. Install WC.
  2. Delete table actionscheduler_actions.
  3. Site crashes.
@jorgeatorres jorgeatorres added the type: enhancement The issue is a request for an enhancement. label Sep 15, 2022
@remyperona
Copy link

It might also be good to update the inline documentation for the API functions to indicate what kind of exceptions they can throw, so that 3rd party can guard against them.

Currently if you don't dig into the AS code, you have no idea that exceptions can be thrown by those functions.

@coreymckrill
Copy link
Contributor

Idea: we could add a Site Health Status check for the Action Scheduler tables, along with a tool for attempting to repair them.

@barryhughes
Copy link
Member

when AS tables are missing, as_schedule_recurring_action() throws a fatal exception.

I'm wondering if we should close this (cc @jorgeatorres for thoughts). Partly because, if the actions table is missing, as_schedule_recurring_action() no longer throws a fatal (it simply returns (int) 0) but also because we have a crop of other related issues that I think we can use to cover this sort of problem (they come at it from slightly different angles, but even so):

Perhaps we can even consolidate some of the above.

@jorgeatorres
Copy link
Member Author

@barryhughes: Makes sense. Feel free to close!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: normal The issue/PR is normal priority—not many people are affected or there’s a workaround, etc. type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

No branches or pull requests

5 participants