From 11f2ba0039288d491c95181fbe96c5ad43ccd7d3 Mon Sep 17 00:00:00 2001 From: Gian <47775302+gpunto@users.noreply.github.com> Date: Fri, 2 Oct 2026 16:08:26 +0200 Subject: [PATCH] Stop the aggregator stress test dropping events on a slow runner The stress test floods 10K events into an unlimited inbox, but the dispatch queue keeps its default capacity of 16. When the dispatcher thread is not scheduled for a moment, the collector fills the queue and drops whole batches by design, so the latch never reaches 10K and the test fails after 60s. Reproducible every time on a single-thread dispatcher. Size the queue to the event count, an upper bound on queued items. Co-Authored-By: Claude Opus 5.5 --- .../core/internal/processing/StreamEventAggregatorImplTest.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/stream-android-core/src/test/java/io/getstream/android/core/internal/processing/StreamEventAggregatorImplTest.kt b/stream-android-core/src/test/java/io/getstream/android/core/internal/processing/StreamEventAggregatorImplTest.kt index c197c4ce..4ef9b38b 100644 --- a/stream-android-core/src/test/java/io/getstream/android/core/internal/processing/StreamEventAggregatorImplTest.kt +++ b/stream-android-core/src/test/java/io/getstream/android/core/internal/processing/StreamEventAggregatorImplTest.kt @@ -841,6 +841,10 @@ class StreamEventAggregatorImplTest { deserializer = deserializer, aggregationThreshold = threshold, maxWindowMs = 500, + // A full dispatch queue drops events by design, and the collector can + // outrun the dispatcher when the inbox is flooded. Every queued item holds + // at least one event, so this capacity can never fill up. + dispatchQueueCapacity = totalEvents, ), )