Skip to content

Commit 9f507c3

Browse files
committed
fix: Clear delivery candidates on cancel
This change ensures that when the `ChannelDeliveryReporter` is canceled, any pending delivery candidates are cleared. The `cancel` method now clears the `_deliveryCandidates` list in addition to canceling the throttled reporting function. This prevents a potential memory leak and ensures a clean state when delivery reporting is stopped.
1 parent 696bce0 commit 9f507c3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/stream_chat/lib/src/client/channel_delivery_reporter.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,5 +193,8 @@ class ChannelDeliveryReporter {
193193
///
194194
/// Typically used when shutting down the reporter or permanently stopping
195195
/// delivery reporting.
196-
void cancel() => _throttledMarkCandidatesAsDelivered.cancel();
196+
void cancel() {
197+
_throttledMarkCandidatesAsDelivered.cancel();
198+
_deliveryCandidatesLock.synchronized(_deliveryCandidates.clear);
199+
}
197200
}

0 commit comments

Comments
 (0)