diff --git a/Analytics/Classes/Internal/SEGSegmentIntegration.m b/Analytics/Classes/Internal/SEGSegmentIntegration.m index 6dcc228a1..238820ebc 100644 --- a/Analytics/Classes/Internal/SEGSegmentIntegration.m +++ b/Analytics/Classes/Internal/SEGSegmentIntegration.m @@ -416,23 +416,13 @@ - (void)enqueueAction:(NSString *)action dictionary:(NSMutableDictionary *)paylo - (void)queuePayload:(NSDictionary *)payload { @try { + if (self.queue.count > 1000) { + // Remove the oldest element. + [self.queue removeObjectAtIndex:0]; + } [self.queue addObject:payload]; [[self.queue copy] writeToURL:[self queueURL] atomically:YES]; [self flushQueueByLength]; - - } - @catch (NSException *exception) { - SEGLog(@"%@ Error writing payload: %@", self, exception); - } -} - -- (void)queuePayloadFromArray:(NSArray *)payloadArray -{ - @try { - [self.queue addObjectsFromArray:payloadArray]; - [[self.queue copy] writeToURL:[self queueURL] atomically:YES]; - [self flushQueueByLength]; - } @catch (NSException *exception) { SEGLog(@"%@ Error writing payload: %@", self, exception);