lifterlms icon indicating copy to clipboard operation
lifterlms copied to clipboard

Loop of cron jobs if course data is locked

Open brianhogg opened this issue 8 months ago • 2 comments

Reproduction Steps

  1. 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_lock with value yes for a course, and update _llms_last_data_calc_run postmeta to a date in the past)
  2. 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.

brianhogg avatar Apr 15 '25 11:04 brianhogg

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.

brianhogg avatar Apr 15 '25 11:04 brianhogg

define( 'LLMS_PROCESSORS_DEBUG', true ); can be added to the wp-config.php to see the log detail of processors

brianhogg avatar Apr 15 '25 12:04 brianhogg