wp-rocket
wp-rocket copied to clipboard
As a support team member, I want to know the last time each RUCSS-related CRON job started and ended so that I know if CRON are running as exepcted
Context
As part of building a RUCSS Debug tool, some information must be stored while in WP Rocket Debug mode so that it can be monitored easily by the support team. More details here: https://www.notion.so/wpmedia/RUCSS-Issues-7adc4ed750fd4dc7902bb6881ed1204b?pvs=4#38398060400d4fcf97f27aa563483d68
Expected behavior When in debug mode (WP_ROCKET_DEBUG?), a timestamp must be updated in the DB every time:
- the CRON process_on_submit_jobs starts
- the CRON process_on_submit_jobs ends successfully
- the CRON process_pending_jobs starts
- the CRON process_pending_jobs ends successfully Those 4 timestamps must be stored in the DB and updated at every new related event.
When debug mode is off, nothing special happens. If the timestamps are in DB, they can stay there.
Scope a solution ✅
In inc/Engine/Optimization/RUCSS/Controller/UsedCSS.php
- In
process_pending_jobs()
, add actionrocket_rucss_process_pending_jobs_start
at the start of the method, androcket_rucss_process_pending_jobs_end
at the end of the method - In
process_on_submit_jobs()
, add actionrocket_rucss_process_on_submit_jobs_start
at the start of the method, androcket_rucss_process_on_submit_jobs_end
at the end of the method
In inc/Engine/Debug/RUCSS
- Add callbacks to the newly created actions, to store the timestamp for each into the debug option (based on 6372)
Estimate the effort ✅
Effort [S]
@MathieuLamiot A note in this case, there is already some existing logging for those
Looks good to me.
Pending for this PR to be merged before being able to test: https://github.com/wp-media/wp-rocket/pull/6411