Skip to content

Commit b2c5bcb

Browse files
committed
Fix - prevent failed events from being dequeued
1 parent 634a452 commit b2c5bcb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/core/lib/plugins/segment_destination.dart

+3-2
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ class SegmentDestination extends DestinationPlugin with Flushable {
3535
final succeeded = await analytics?.httpClient.startBatchUpload(
3636
analytics!.state.configuration.state.writeKey, batch,
3737
host: _apiHost);
38-
if (succeeded == null || !succeeded) {
38+
if (succeeded == true) {
39+
sentEvents.addAll(batch);
40+
} else {
3941
numFailedEvents += batch.length;
4042
}
41-
sentEvents.addAll(batch);
4243
} catch (e) {
4344
numFailedEvents += batch.length;
4445
} finally {

0 commit comments

Comments
 (0)