Usage_Reports::generate_report_schedule()

generate_report_schedule


Description Description

Will return an integer from 100 (Monday midnight) to 723 (Sunday 11PM)

If too many sites will report at the same time, the API may be overloaded. Therefore we need to make sure the reports are sent at random times to distribute the load evenly across the week.


Top ↑

Return Return

(void)


Source Source

File: src/core/classes/class-usage-reports.php

	public function generate_report_schedule() {

		$random_day  = wp_rand( 1, 7 );
		$random_hour = wp_rand( 0, 23 );

		$report_day_hour = absint( $random_day . $this->leading_zeros( $random_hour ) );

		return $report_day_hour;
	}