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.
Return Return
(boolean) When true the dispatch is throttled and when false it will run.
Source Source
File: includes/processors/class.llms.processor.course.data.php
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 );
}
Expand full source code Collapse full source code View on GitHub
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. |