techcrunch / wp-async-task

MIT License
730 stars 74 forks source link

Questions about environment dependencies #10

Open goldenapples opened 8 years ago

goldenapples commented 8 years ago

Hi, I'm just getting started playing with this library. One thing I've noticed is that in my local development environment (a more or less stock VIP Quickstart Vagrant box on a Macbook Pro), the post to admin-post.php always fails with the 0.01s timeout in the plugin.

Is there a reason why this needs to be set so low? The request is non-blocking anyways, Is there any reason a default timeout can't work?

In addition, the only way I could make the admin-post callback complete was by adding @ignore_user_abort( true ); to my local admin-post.php (or the equivalent value in php.ini, though that's even sketchier...). Is this a requirement for the plugin to work, and if so, should it be documented somewhere?

rayrutjes commented 8 years ago

Currently also having issues debuging the remote calls. Locally I have every request failing but the actual tasks are correctly run. That said, on some other environments, the task will not run, but the errors remain the same.

I agree with @goldenapples , we should try to document the requirements for the "async" trick to work. Currently I do not feel it is very reliable.

Some points that needs to be addressed:

Great work though! Keep it up!

r-a-y commented 8 years ago

the post to admin-post.php always fails with the 0.01s timeout in the plugin.

0.01 is the same timeout as used when WP triggers cron in spawn_cron(). This timeout value has been talked about on WP Trac a few times, most notably: https://core.trac.wordpress.org/ticket/18738

There probably should be a filter for the arguments in wp_remote_post() similar to WP Cron. See #12.