A5hleyRich / wp-background-processing-example

120 stars 42 forks source link

Dispatch seems to have no effect. #2

Open mhdtahawi opened 7 years ago

mhdtahawi commented 7 years ago

Hi, Thank you for the efforts. I am sure it is not working because I am not using it correctly. I am hoping you can help me with that :)

Here is what I am doing:

class WP_Example_Request extends WP_Async_Request {

    /**
     * @var string
     */
    protected $action = 'create_send_pdf';

    /**
     * Handle
     *
     * Override this method to perform any actions required
     * during the async request.
     */
    protected function handle() {

       file_put_contents("logs.txt", "writing file" );

    }

and in my code:

echo ("callign backgroudnd thread <br />");
$example_request = new WP_Example_Request();
$example_request->data( array( 'orderID' => $_GET["orderID"] ) )->dispatch();
echo (" backgroudnd thread called");

It seems like the file is not being written any where. I am trying to find a way to log what I am doing, to be able debug later.

Anything I am doing wrong?

elvismdev commented 5 years ago

@mhdtahawi I have the same issue, did you figure this out?

w33zy commented 5 years ago

It's my first time looking at this library and I am having the same issue.

I am using background processing and I am seeing the wp_{action} added to the wp_options table but I am not seeing any new WP Cron events added to the queue.

DeveloperWil commented 5 years ago

Did anyone ever get a fix for this? My dispatch is not adding new cron jobs either.

ram33z commented 5 years ago

same issue

DeveloperWil commented 5 years ago

Looks like it's borked. I'm going to go with Delicious Brains background processor - looks like it's written by the same guy but hopefully it works https://github.com/deliciousbrains/wp-background-processing