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
Fix marketplace promotions action scheduler #46630
Fix marketplace promotions action scheduler #46630
Conversation
Hi @lsinger, @Dan-Q, @corsonr, @psealock, @ilyasfoo, @alexflorisca, @imanish003, @woocommerce/rubik, @woocommerce/solaris, @woocommerce/mothra, @woocommerce/ghidorah, @woocommerce/woo-fse, @woocommerce/developer-advocacy, @woocommerce/vortex Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good, I can confirm that there's no more fatal error, and that the promotions do show fine on the extensions page so as the menu bubble.
Note to other reviewers: the gist adjustments should be done at line 100, not 97. Also do not forget to revert changes and cancel the 5min woocommerce_marketplace_fetch_promotions
scheduled action so that it goes back to 12h.
* Defensive coding for when `as_has_scheduled_action` Action Scheduler function is not defined. * Changelog.
* Fix marketplace promotions action scheduler (#46630) * Defensive coding for when `as_has_scheduled_action` Action Scheduler function is not defined. * Changelog. * Prep for cherry pick 46630 --------- Co-authored-by: And Finally <andfinally@users.noreply.github.com> Co-authored-by: WooCommerce Bot <no-reply@woo.com>
* Defensive coding for when `as_has_scheduled_action` Action Scheduler function is not defined. * Changelog.
@corsonr this fix has caused an issue with WooCommerce "Woo Subscriptions" from the day we updated to this, we have been getting several "Failed-scheduled-actions" logs. 2024-04-21T00:08:41+00:00 Notice scheduled action 665467 (subscription payment) failed to finish processing due to the following exception: Call to a member function meta_exists() on null |
A fix has already been pushed by @andfinally if I am correct |
Submission Review Guidelines:
Changes proposed in this Pull Request:
WooCommerce 8.8.1 introduced some code dependent on Action Scheduler 3.3+. Under normal circumstances that'd be ok, as this WooCommerce version comes bundled with A-S 3.7.0. But other plugins that also bundle A-S might be loading their version of A-S unusually early, preventing the one in WC from loading. In this situation, activating WooCommerce would give rise to this fatal error.
This PR adds defensive checks to
WC_Admin_Marketplace_Promotions
to ensure A-S functions are available before it calls them.Notes
as_has_scheduled_action
: BatchProcessingController and TransientFilesEngine. However, these other calls do not cause errors which totally break wp-admin. This critical error seems more urgent, so I haven't touched those other areas in this PR. I've created a separate issue for them: Use modern A-S functions more cautiously #46632.cURL error 35: OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to [woocommerce.com:443](http://woocommerce.com:443/)
. So the content isn't rendered. This is not related to the current change: it happens in trunk too. It's probably due to local configuration on wp-env.How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
Testing the marketplace promotions still work
plugins/woocommerce/includes/admin/class-wc-admin-marketplace-promotions.php
and replace line 97 with this. This makes a request to a gist with dummy data that is valid until 1 May.woocommerce_marketplace_fetch_promotions
. If there's a pending action, cancel it using the "cancel" hover link under it in the list. A new action should be scheduled.WooCommerce > Extensions
menu item, and the notice should appear on Marketplace pages likehttp://localhost:8888/wp-admin/admin.php?page=wc-admin&path=%2Fextensions
.Changelog entry
Significance
Type
Message
Comment