Merge pull request #17985 from woocommerce/refactor/12439-improve-duration

Improve webhook delivery duration
This commit is contained in:
Claudiu Lodromanean 2017-12-01 14:33:49 -08:00 committed by GitHub
commit 19969636f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -189,7 +189,8 @@ class WC_Webhook extends WC_Legacy_Webhook {
* @param mixed $arg First hook argument.
*/
public function deliver( $arg ) {
$payload = $this->build_payload( $arg );
$start_time = microtime( true );
$payload = $this->build_payload( $arg );
// Setup request args.
$http_args = array(
@ -218,8 +219,6 @@ class WC_Webhook extends WC_Legacy_Webhook {
$http_args['headers']['X-WC-Webhook-ID'] = $this->get_id();
$http_args['headers']['X-WC-Webhook-Delivery-ID'] = $delivery_id;
$start_time = microtime( true );
// Webhook away!
$response = wp_safe_remote_request( $this->get_delivery_url(), $http_args );