From 84d1d69f6b2394ad0cdfc4547eb233f90efad261 Mon Sep 17 00:00:00 2001 From: jdv Date: Tue, 2 Jun 2026 14:56:18 +0200 Subject: [PATCH] fix(watcher): Batch push signals to avoid big payload issues --- CHANGELOG.md | 10 ++++++++++ src/Constants.php | 2 +- src/Watcher.php | 10 ++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab17c38..cf2794d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,16 @@ The [public API](https://semver.org/spec/v2.0.0.html#spec-item-1) of this librar As far as possible, we try to adhere to [Symfony guidelines](https://symfony.com/doc/current/contributing/code/bc.html#working-on-symfony-code) when deciding whether a change is a breaking change or not. +--- + +## [3.5.3](https://github.com/crowdsecurity/php-capi-client/releases/tag/v3.5.3) - 2026-06-02 +[_Compare with previous release_](https://github.com/crowdsecurity/php-capi-client/compare/v3.5.2...v3.5.3) + + +### Changed + +- Push signals in batches of 50 to avoid issues with large payloads + --- ## [3.5.2](https://github.com/crowdsecurity/php-capi-client/releases/tag/v3.5.2) - 2026-02-06 diff --git a/src/Constants.php b/src/Constants.php index b15eae4..fef382b 100644 --- a/src/Constants.php +++ b/src/Constants.php @@ -85,5 +85,5 @@ class Constants extends CommonConstants /** * @var string The current version of this library */ - public const VERSION = 'v3.5.2'; + public const VERSION = 'v3.5.3'; } diff --git a/src/Watcher.php b/src/Watcher.php index a1b799c..42d61a6 100644 --- a/src/Watcher.php +++ b/src/Watcher.php @@ -247,10 +247,16 @@ public function getStreamDecisions(): array * @throws ClientException */ public function pushSignals(array $signals): array - { + { + $batchSize = 50; $indexedSignals = array_values($signals); + $chunks = array_chunk($indexedSignals, $batchSize); + $result = []; + foreach ($chunks as $chunk) { + $result = $this->manageRequest('POST', Constants::SIGNALS_ENDPOINT, $chunk); + } - return $this->manageRequest('POST', Constants::SIGNALS_ENDPOINT, $indexedSignals); + return $result; } /**