From 6cac8a5b7e2733c393f873f2a8acdc2767c3d686 Mon Sep 17 00:00:00 2001 From: Chris Huber Date: Tue, 3 Mar 2026 22:33:21 +0000 Subject: [PATCH] fix: default max_items to 1 at runtime to prevent unbounded batch fan-out Existing flows lacked a persisted max_items value, causing the ?? 0 fallback (unlimited) to trigger. This led to hundreds of child jobs from a single Ticketmaster/Dice.fm fetch, flooding the Action Scheduler queue. The settings UI already defaulted to 1 but that was only a form hint, never applied at runtime. --- inc/Core/Steps/Fetch/Handlers/FetchHandler.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/inc/Core/Steps/Fetch/Handlers/FetchHandler.php b/inc/Core/Steps/Fetch/Handlers/FetchHandler.php index 94fc07bd..27ec56f5 100644 --- a/inc/Core/Steps/Fetch/Handlers/FetchHandler.php +++ b/inc/Core/Steps/Fetch/Handlers/FetchHandler.php @@ -80,8 +80,10 @@ final public function get_fetch_data( int|string $pipeline_id, array $handler_co // Items without dedup_key pass through unchanged. $items = $this->dedup( $items, $context ); - // Apply max_items cap when configured. - $max_items = (int) ( $config['max_items'] ?? 0 ); + // Apply max_items cap. + // Default to 1 to prevent unbounded fan-out when flows lack an + // explicit max_items value. Set to 0 for unlimited. + $max_items = (int) ( $config['max_items'] ?? 1 ); if ( $max_items > 0 && count( $items ) > $max_items ) { $items = array_slice( $items, 0, $max_items ); }