Skip to content

Create Background Processing Infrastructure: Create Perflab_Background_Process::time_exceeded method #494

@jjgrainger

Description

@jjgrainger

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 );`

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions