imagify-plugin icon indicating copy to clipboard operation
imagify-plugin copied to clipboard

Added a try catch for the fatal error

Open CrochetFeve0251 opened this issue 2 years ago • 2 comments

Fix the issue due to the Runtime exception raised by Action Scheduler when the tables are not present.

Fix #720

CrochetFeve0251 avatar May 02 '23 12:05 CrochetFeve0251

@CrochetFeve0251 thanks for the PR. Can see the error on the PR with the following steps: (can you please check) precondition: manually delete AS tables from database 1- fresh install and activation of imagify 2- add keys => error appeared although it's valid 3- open imagify settings https://new.rocketlabsqa.ovh/wp-admin/options-general.php?page=imagify => error in logs [24-May-2023 14:52:49 UTC] PHP Fatal error: Uncaught RuntimeException: Unable to claim actions. Database error. in /var/www/new.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify-plugin/inc/Dependencies/ActionScheduler/classes/data-stores/ActionScheduler_DBStore.php:938 Stack trace: #0 /var/www/new.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify-plugin/inc/Dependencies/ActionScheduler/classes/data-stores/ActionScheduler_DBStore.php(799): ActionScheduler_DBStore->claim_actions() #1 /var/www/new.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify-plugin/inc/Dependencies/ActionScheduler/classes/data-stores/ActionScheduler_HybridStore.php(221): ActionScheduler_DBStore->stake_claim() #2 /var/www/new.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify-plugin/inc/Dependencies/ActionScheduler/classes/ActionScheduler_QueueRunner.php(157): ActionScheduler_HybridStore->stake_claim() #3 /var/www/new.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify-plugin/inc/Dependencies/ActionScheduler/classes/ActionScheduler_QueueRunner.php(136): ActionScheduler_QueueRunner->do_batch() #4 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-hook.php(308): ActionScheduler_QueueRunner->run() #5 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters() #6 /var/www/new.rocketlabsqa.ovh/htdocs/wp-includes/plugin.php(565): WP_Hook->do_action() #7 /var/www/new.rocketlabsqa.ovh/htdocs/wp-cron.php(188): do_action_ref_array() #8 {main} thrown in /var/www/new.rocketlabsqa.ovh/htdocs/wp-content/plugins/imagify-plugin/inc/Dependencies/ActionScheduler/classes/data-stores/ActionScheduler_DBStore.php on line 938 @piotrbak please advise if we need to recreate the tables :pray:

Note: we won't be able to delete the plugin in this case from plugins list

Mai-Saad avatar May 24 '23 14:05 Mai-Saad

@CrochetFeve0251 Aren't we checking the AS tables when installing/updating the WP Rocket? 🤔

piotrbak avatar Jun 02 '23 08:06 piotrbak