Skip to main content

Filter: gfpdf_gv_bulk_export_continue_batch

Whether the current batch should render another document — the seam for stopping on memory pressure.

This is the only adaptive bound on a batch. {@see \self::BATCH_SIZE} caps the document count and Foundation's deadline caps the wall-clock time, but both are fixed before the batch runs and neither can see memory — and mPDF holds a whole document in RAM while it renders, so a large PDF on a host near its limit can exhaust memory well inside the count and the deadline. Because each background batch is a fresh async request (memory resets between them), a host can checkpoint the moment usage climbs and let the next batch start clean:

add_filter( 'gfpdf_gv_bulk_export_continue_batch', function ( $continue ) \{         return $continue && memory_get_usage( true ) < 200 * MB_IN_BYTES;     \} );

Reducing {@see \self::BATCH_SIZE} via GravityView's action registry is the static alternative, but it slows every export to guard against the worst-case one and still can't react at render time.

Background batches only — a selection under {@see \self::BACKGROUND_THRESHOLD} runs during the request and never reaches here — and ignored for the first document of a batch, which always renders (a checkpoint that made no progress fails the whole job).

Parameters

NameTypeDescription
$continueboolWhether Foundation's wall-clock deadline still allows another document.
$contextarrayThe background job context.

Since

  • 2.0

Source

Defined in src/GravityView/BulkExport.php at line 525