-
Notifications
You must be signed in to change notification settings - Fork 131
Closed as not planned
Closed as not planned
Copy link
Labels
[Plugin] Performance LabIssue relates to work in the Performance Lab Plugin onlyIssue relates to work in the Performance Lab Plugin only[Plugin] Regenerate Existing ImagesIssues for the Regenerate Existing Images moduleIssues for the Regenerate Existing Images module
Description
Create Perflab_Background_Process::run method
Create a new a Perflab_Background_Process
class to handle the background process runs.
This class will contain other helper methods for running jobs the background process built out in other issues.
- Create Background Processing Infrastructure: Create Perflab_Background_Process::memory_exceeded method #493
- Create Background Processing Infrastructure: Create Perflab_Background_Process::time_exceeded method #494
Acceptance Criteria
- Create a new
run( int $job_id )
method in thePerflab_Background_Process
class. - The method will run through the following steps sequentially.
-
Set the start time
A$start_time
variable is set using the current timestamp as the value. -
Lock the process
- The job process is locked by setting a term meta against the job term. The meta key will be
job_lock
and the value the current timestamp. - The job status is also updated by setting the
job_status
meta torunning
- Retrieve the job information
Using the$job_id
passed to therun
method get the following information.
$job
- Create a new Job object using thePerflab_Background_Job
class$job_name
this is the the job terms slug$job_data
this is from thejob_data
term meta
- Call the job action
Within a do/while loop calldo_action( 'perflab_job_' . $job_name, $job_id, $job_data );
The while loop conditions will call the following like so:
while( ! $this->memory_exceeded() && ! $this->time_exceeded() && ! $job->is_completed( $job_id ) )
-
Unlock process
Outside of the while loop, to end the process, unlock the job by removing thejob_lock
term meta. -
Start the next batch process
Start the next batch process by calling the functionperflab_background_process_next_batch()
passing the$job_id
as the only parameter.
felixarntz
Metadata
Metadata
Assignees
Labels
[Plugin] Performance LabIssue relates to work in the Performance Lab Plugin onlyIssue relates to work in the Performance Lab Plugin only[Plugin] Regenerate Existing ImagesIssues for the Regenerate Existing Images moduleIssues for the Regenerate Existing Images module