Merge pull request #1475 from mapbox/1474-ttl

Metrics Event TTL Fix
This commit is contained in:
Brad Leege
2015-05-08 10:36:25 -05:00

View File

@@ -382,10 +382,10 @@ NSString *const MGLEventGestureRotateStart = @"Rotation";
// Has Flush Limit Been Reached?
if (_eventQueue.count >= strongSelf.flushAt) {
[strongSelf flush];
} else if (_eventQueue.count == 1) {
// If this is first new event on queue start timer,
[strongSelf startTimer];
}
// Reset Timer (Initial Starting of Timer after first event is pushed)
[strongSelf startTimer];
});
}
@@ -425,6 +425,12 @@ NSString *const MGLEventGestureRotateStart = @"Rotation";
// Send Array of Events to Server
[strongSelf postEvents:events];
// Cancel Any Timer That May Running
if (strongSelf.timer) {
[strongSelf.timer invalidate];
strongSelf.timer = nil;
}
});
}