wp-background-processing icon indicating copy to clipboard operation
wp-background-processing copied to clipboard

Bug : The script is breaking from front end.

Open kumarmanishc opened this issue 4 years ago • 1 comments

My Use case of this library

I'm using this library to schedule an execution that will make an api call when if order will be place from Store.

Current behaviour

This is scheduling process and making API calls as expected.

Crucial Bug

  1. After dispatch it's breaking script that is causing the thankyou page is not fully loading.
  2. Some hooks are not getting triggered which does after placing order on thankyou page

Found the cause

After struggling I tried some debugging and found that in the file classes/wp-background-process.php, there is function public function schedule_cron_healthcheck( $schedules ) which is filter callback.

$interval = apply_filters( $this->identifier . '_cron_interval', 5 ); if ( property_exists( $this, 'cron_interval' ) ) { $interval = apply_filters( $this->identifier . '_cron_interval', $this->cron_interval ); }

If I comment this three line the thankyou page is not breaking and all actions are being executed But result is If I comment above lines the handle function is not calling and API is not performing.

Please look into this and suggest If I can do any changes to get it working as expected.

Will be waiting to hear from Envelopment Team

kumarmanishc avatar Jun 11 '21 11:06 kumarmanishc

We are facing the exact same issue

FawadNL avatar Oct 12 '21 21:10 FawadNL

This is strange, commenting out the following stops a page on your site from breaking?

if ( property_exists( $this, 'cron_interval' ) ) {
	$interval = apply_filters( $this->identifier . '_cron_interval', $this->cron_interval );
}

If so ...

  1. Have you added a $cron_interval property to your WP_Background_Process subclass?
  2. What is the (Fatal?) error being thrown without those lines commented out?
  3. What version of PHP is in use?

ianmjones avatar Apr 11 '23 18:04 ianmjones