Loop of cron jobs if course data is locked
Reproduction Steps
- For a Course that has had data calculated in the past, generate an error when course data is being calculated by a background process (or fake by adding postmeta
_llms_temp_calc_data_lockwith valueyesfor a course, and update_llms_last_data_calc_runpostmeta to a date in the past) - Enroll a student in the course to trigger a recalculation of the course data
Expected Behavior
Due to lock, will try every 4 hours to add the recalculation to the queue
Actual Behavior
Will add a cron task to recheck in the past (4 hours after the last calculation run by default, unless filtered) which will continuously check every second. There's also no way to clear the lock without manually editing the database.
Can use WP Control to see the cron llms_course_calculate_data fires.
Test by first seeing the cron fires every second, then applies every 4 hours after applying the fix. Then test clearing the lock and see that the batch is added for processing.
Can see the batches are processing if it's a large site by looking at the LifterLMS > Status , "Tools & Utilities" tab. "Delete batches" should be an option and say the number of batches remaining in the description.
If batches are processing, there should be a llms_background_process_course_data_cron cron job visible in WP Control that calls a health check function on the LLMS_Processor_Course_Data class every 5 minutes or so.
define( 'LLMS_PROCESSORS_DEBUG', true ); can be added to the wp-config.php to see the log detail of processors