Skip to content

Commit

Permalink
fix: increase mjml request timeout, handle errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffersonrabb committed Apr 14, 2020
1 parent 6bbfcfe commit aa1f3c4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions includes/class-newspack-newsletters-renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,10 @@ public static function render_html_email( $post ) {
'headers' => array(
'Authorization' => 'Basic ' . base64_encode( $mjml_creds ),
),
'timeout' => 45, // phpcs:ignore WordPressVIPMinimum.Performance.RemoteRequestTimeout.timeout_timeout
)
);

$email_html = json_decode( $request['body'] )->html;
return $email_html;
return is_wp_error( $request ) ? $request : json_decode( $request['body'] )->html;
}
}
}

0 comments on commit aa1f3c4

Please sign in to comment.