Skip to content

Create Background Processing Infrastructure: Create wp_ajax request handler for perflab_start_background_job function #481

@mxbclang

Description

@mxbclang

Create a new function and action that handles the HTTP request sent from the perflab_start_background_job.

Acceptance Criteria

  • Create a custom function and register to the action wp_ajax_background_process_handle_request
    • The function accepts no parameters and takes data from the request
  • The function will process the request as follows
    • Verify the request by checking the nonce passed with check_ajax_referer function
      • If the verification fails, the action will return early
    • Verify the job is not currently running
      • Take the $job_id from the HTTP request data
      • Using the job ID, check the job_lock term meta for this specific job
      • If the job_lock term meta is set, the job is running and the action will return early
    • If both checks above past, the job is run by calling the perflab_background_process_run function
      • The perflab_background_process_run is called passing the $job_id as it's only parameter
      • The perflab_background_process_run does not return anything (void)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions