LLMS_Processor_Course_Data::maybe_throttle( int $num_students, int $course_id )

For large courses, only recalculate once every 4 hours


Parameters Parameters

$num_students

(int) (Required) Number of students in the current course.

$course_id

(int) (Required) WP_Post ID of the course.


Top ↑

Return Return

(boolean) When true the dispatch is throttled and when false it will run.


Top ↑

Source Source

File: includes/processors/class.llms.processor.course.data.php

316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
protected function maybe_throttle( $num_students, $course_id ) {
 
    $throttled = false;
 
    if ( $num_students >= $this->throttle_max_students ) {
 
        $throttled = ( time() - $this->get_last_run( $course_id ) <= $this->throttle_frequency );
 
    }
 
    /**
     * Filters whether or not data processing is throttled for a request
     *
     * @since 4.12.0
     *
     * @param boolean $throttled    If `true`, the processing for the current request is throttled, otherwise data processing will begin.
     * @param int     $num_students Number of students in the current course.
     * @param int     $course_id    WP_Post ID of the course.
     * $param int     $max_students Maximum number of students in the course before processing is throttled.
     */
    return apply_filters( 'llms_data_processor_course_data_throttled', $throttled, $num_students, $course_id, $this->throttle_max_students );
 
}


Top ↑

Changelog Changelog

Changelog
Version Description
4.12.0 Adjusted access from private to protected. Pull last run data on a per-course basis. Added parameter $course_id.
3.15.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.