-
Notifications
You must be signed in to change notification settings - Fork 143
Create Background Processing Infrastructure: Create Status Cron Event #484
Copy link
Copy link
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:hourlyhook: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_statusmeta 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_lockterm meta value - Check the job_lock value against the
ini_get( 'max_execution_time' ) - If the
job_lockmeta exists and the value is less than themax_execution_timecontinue to the next term - If the
job_lockmeta does not exist or the value is greater themax_execution_timerestart the job by callingperflab_start_background_jobpassing 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_statusmeta 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_atterm meta value - If the job_completed_at meta exists and the timestamp value is older than 7 days, the term is deleted.
- Retrieve the
Reactions are currently unavailable
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
Type
Fields
Give feedbackNo fields configured for issues without a type.