WP_Background_Process::maybe_handle()

Maybe process queue

Description

Checks whether data exists within the queue and that the process is not already running.

Source

File: bp-core/libraries/wp-background-process.php

161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
public function maybe_handle() {
    // Don't lock up other requests while processing
    session_write_close();
 
    if ( $this->is_process_running() ) {
        // Background process already running.
        wp_die();
    }
 
    if ( $this->is_queue_empty() ) {
        // No data to process.
        wp_die();
    }
 
    check_ajax_referer( $this->identifier, 'nonce' );
 
    $this->handle();
 
    wp_die();
}

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.