Skip to content

Create Background Processing Infrastructure: Create wp_ajax_background_process_next_batch handler #483

@mxbclang

Description

@mxbclang

Create a new function and action that handles the HTTP request sent from the perflab_background_process_next_batch. This will process the request and start the next batch run for the job ID passed.

Acceptance Criteria

  • Create a custom function and register to the action wp_ajax_background_process_next_batch
    • 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 key passed within the request data
      • The key is checked against the value stored in the options table under background_process_key_{$job_id}
      • If the keys do not match, 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 background_process_key_{$job_id} option is deleted from the option table

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions