diff options
author | Brad Leege <bleege@gmail.com> | 2015-05-08 10:13:05 -0500 |
---|---|---|
committer | Brad Leege <bleege@gmail.com> | 2015-05-08 10:13:05 -0500 |
commit | ea3979b19e08d5893347e648bbdc28bbb9bfe010 (patch) | |
tree | 55077fc9fad252bb4c32e03fdf2363014767a1f6 /platform | |
parent | adec24c97c59dffeb7e49bc20d6422f0fbc4cb0a (diff) | |
download | qtlocation-mapboxgl-ea3979b19e08d5893347e648bbdc28bbb9bfe010.tar.gz |
#1474 - Refactoring timer to be started when first event is added to queue. Debug logic and content also included
Diffstat (limited to 'platform')
-rw-r--r-- | platform/ios/MGLMapboxEvents.m | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m index 4450fa87fb..b5a2195463 100644 --- a/platform/ios/MGLMapboxEvents.m +++ b/platform/ios/MGLMapboxEvents.m @@ -163,7 +163,7 @@ NSString *const MGLEventGestureRotateStart = @"Rotation"; // Events Control _eventQueue = [[NSMutableArray alloc] init]; _flushAt = 20; - _flushAfter = 60; + _flushAfter = 15; _token = nil; _instanceID = [[NSUUID UUID] UUIDString]; @@ -382,16 +382,20 @@ 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, + NSLog(@"event queue is 1, start timer."); + [strongSelf startTimer]; + } else { + NSLog(@"event queue is != 1, don't adjust timer."); } - - // Reset Timer (Initial Starting of Timer after first event is pushed) - [strongSelf startTimer]; }); } // Can be called from any thread. // + (void) flush { + NSLog(@"+flush called (likely timer)"); [[MGLMapboxEvents sharedManager] flush]; } |