-
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 a Status Cron Event to check jobs are running correctly and remove old completed jobs.
Acceptance Criteria
Cron Schedule
- Scheduled a new event using the wp_schedule_event function.
- The event is scheduled with the following parameters
timestamp
:time()
recurrence
:hourly
hook
:perflab_background_process_status_check
Event hook
Create a new function for the perflab_background_process_status_check
hook that checks the following
Check jobs are running correctly
- Query jobs that are currently running with
get_terms
- Retrieve running jobs by querying for terms with the
job_status
meta and the valuerunning
. - If no terms are returned continue to next check.
- If terms are passed, loop over each term and check the following:
- Retrieve the
job_lock
term meta value - Check the job_lock value against the
ini_get( 'max_execution_time' )
- If the
job_lock
meta exists and the value is less than themax_execution_time
continue to the next term - If the
job_lock
meta does not exist or the value is greater themax_execution_time
restart the job by callingperflab_start_background_job
passing the$job_id
- Retrieve the
Remove old completed jobs
- Query jobs that are currently running with
get_terms
- Retrieve running jobs by querying for terms with the
job_status
meta and the valuecompleted
. - If no terms are returned exit early.
- If terms are passed, loop over each term and check the following:
- Retrieve the
job_completed_at
term meta value - If the job_completed_at meta exists and the timestamp value is older than 7 days, the term is deleted.
- Retrieve the
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