Skip to content

Create Background Processing Infrastructure: Create Perflab_Background_Process::memory_exceeded method #493

@jjgrainger

Description

@jjgrainger

Create a new Perflab_Background_Process::memory_exceeded method to calculate and return the memory used within the background process. This functions checks the total memory used is 90% of the servers memory limit. The boolean returned is also filterable so other developers can set the memory limit.

Acceptance Criteria

  • Create a new memory_exceeded method the Perflab_Background_Process class
  • The method accepts no parameters
  • The method returns a boolean
  • The total memory limit is calculated by taking ini_get( 'memory_limit' ) or a fallback value of 128M. This value is then converted to bytes using the wp_convert_hr_to_bytes function and multiplied by 0.9 to calculate 90% of the total memory limit.
  • The calculated memory limit is tested by checking if it is >= to the value returned by memory_get_usage()
  • The boolean value returned is filtered using apply_filters( perflab_background_process_memory_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