Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Background Processing Infrastructure: Create perflab_background_process_next_batch function #490

Open
Tracked by #24
jjgrainger opened this issue Aug 19, 2022 · 0 comments
Assignees
Labels
[Module] Regenerate Existing Images Issues for the Regenerate Existing Images module [Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only

Comments

@jjgrainger
Copy link
Contributor

jjgrainger commented Aug 19, 2022

Create a new perflab_background_process_next_batch function to handle subsequent requests to process additional job batches.

This function is created in the module file called modules/images/regenerate-existing-images/background-process.php

Acceptance Criteria

  • Function accepts the following parameters
    • $job_id - A integer that is the ID for a job to run the next batch for.
  • The function will create a new requests key to pass in the request.
    • Generate a random key with the wp_generate_password function
    • Save that key to the options table with the key background_process_key_{$job_id}
  • The function will make a HTTP request to the admin-ajax.php endpoint with the wp_remote_post along with the following parameters
    • action: wp_ajax_background_process_next_batch
    • timeout: 0.1
    • data: array( 'job_id' => $job_id, 'key' => $key )
    • blocking: false
    • sslverify: apply_filters( 'https_local_ssl_verify', false )
  • The function will return the following depending on success or failure
    • On failure the function returns the WP_Error from wp_remote_post
    • On success, the function returns true
@jjgrainger jjgrainger added [Focus] Images [Module] Regenerate Existing Images Issues for the Regenerate Existing Images module labels Aug 19, 2022
@jjgrainger jjgrainger added this to Backlog in [Focus] Images via automation Aug 19, 2022
@ankitrox ankitrox self-assigned this Oct 6, 2022
@felixarntz felixarntz added the [Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only label Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Module] Regenerate Existing Images Issues for the Regenerate Existing Images module [Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only
Projects
No open projects
Development

No branches or pull requests

4 participants