Delicious Brains

Documentation

Background Processes Slow or Not Completing

WP Offload S3 relies heavily on background processing, which allows long running tasks to complete without having any negative impact on your users. If you notice issues with sidebar tools not processing, please check the below recommendations:

Cron

Cron should run at a minimum of every 5 minutes and it’s advised that a true cron job is configured. This article details the process.

Basic Authentication

If your site is protected by basic authentication, background processes will be unable to spawn. To prevent this you must pass your basic auth credentials to the HTTP class when sending requests to a local URL. The following filter should allow you to do this, but remember to substitute your username and password:

function dbi_http_request_args( $r, $url ) {
    if ( 0 === strpos( $url, home_url() ) ) {
        $r['headers']['Authorization'] = 'Basic ' . base64_encode( USERNAME . ':' . PASSWORD );
    }

    return $r;
}
add_filter( 'http_request_args', 'dbi_http_request_args', 10, 2);

Hostname Resolution

WP Offload S3 uses wp_remote_post() to make requests to your site at http://example.com/wp-admin/admin-ajax.php. The server hosting the site needs to be able to resolve the hostname of your site. If you can’t ping your site’s hostname from the server, WP Offload S3 will not be able to dispatch background processes.

Time Limits

All background processes within WP Offload S3 are performed in small batches to prevent long running tasks and reduce the chance of server time limits being reached. However, in some circumstances, a batch may run for longer than 30 seconds and it may be required to increase your PHP maximum execution time.

In your php.ini file increase the following value:

max_execution_time = 300 ; // 5 minutes

You may also need to increase your PHP memory limit if you start receiving memory exhausted errors. If you are unable to change any of these values you should contact your host.