Create a new Perflab_Background_Process::time_exceeded to calculate the total time used within the background process. This function checks the total time taken within the background process so that it can break the while loop 10 seconds before the server timeout limit is reached. The boolean value returned by the function will be filterable to allow other developers to modify the timeout limit.
Acceptance Criteria
- Create a new
time_exceeded method in the Perflab_Background_Process class
- The method accepts no parameters
- The method returns a boolean
- The total timeout limit is calculated by taking the value of
ini_get( 'max_execution_time' ) or a fallback value of 30 seconds, minus 10 seconds. This becomes the $limit value.
- The timeout limit is tested by checking the
time() >= ( $start_time + $limit )
- The boolean value returned is filtered using apply_filters(
perflab_background_process_time_exceeded, $return );`
Create a new
Perflab_Background_Process::time_exceededto calculate the total time used within the background process. This function checks the total time taken within the background process so that it can break the while loop 10 seconds before the server timeout limit is reached. The boolean value returned by the function will be filterable to allow other developers to modify the timeout limit.Acceptance Criteria
time_exceededmethod in thePerflab_Background_Processclassini_get( 'max_execution_time' )or a fallback value of 30 seconds, minus 10 seconds. This becomes the$limitvalue.time() >= ( $start_time + $limit )perflab_background_process_time_exceeded, $return );`