buddypress-group-email-subscription icon indicating copy to clipboard operation
buddypress-group-email-subscription copied to clipboard

Self-pings can take a long time

Open boonebgorges opened this issue 5 years ago • 2 comments

I've had a few reports of self-pings taking a long time, specifically the dispatch() calls that can make the pageload appear to hang when posting new content.

After some experimentation (including a local installation where I was experiencing the problem) I discovered that the cURL requests were failing because of DNS lookup issues. If I filtered bpges_async_request_query_url and replaced the domain name with the IP address, the problem went away. Something like this:

add_filter(
  'bpges_async_request_query_url',
  function( $url ) {
    return set_url_scheme( 'http://127.0.0.1/wp-admin/admin-ajax.php' );
  }
);

I'm unsure whether this is safe or wise to do in the plugin itself. I'm opening the ticket to track the issue and possibly gather feedback.

boonebgorges avatar Apr 24 '19 15:04 boonebgorges

I've had mixed results with the solution above. Another possibility is that you can reduce the timeout back to the default in wp-background-processing, though then you have to be sure to monitor that the emails are actually going out:

add_filter(
  'bpges_async_request_http_request_args',
  function( $args ) {
    $args['timeout'] = '0.01';
    return $args;
  }
);

boonebgorges avatar Apr 24 '19 15:04 boonebgorges

I ran into an edge case where if the main site is not secure and served over HTTP, the GES query URL might be forced to use HTTPS (by another plugin or code snippet filtering site_url or something like that).

If that is the case, doing something like what Boone mentions in the first post works.

This is what I did:

add_filter( 'bpges_async_request_query_url', function( $retval ) {
	return set_url_scheme( $retval, 'http' );
}, 9999 );

r-a-y avatar Jun 04 '19 10:06 r-a-y