summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLNetworkConfiguration.m
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/src/MGLNetworkConfiguration.m')
-rw-r--r--platform/darwin/src/MGLNetworkConfiguration.m7
1 files changed, 5 insertions, 2 deletions
diff --git a/platform/darwin/src/MGLNetworkConfiguration.m b/platform/darwin/src/MGLNetworkConfiguration.m
index 2335fcce0b..0e5046e7a3 100644
--- a/platform/darwin/src/MGLNetworkConfiguration.m
+++ b/platform/darwin/src/MGLNetworkConfiguration.m
@@ -67,8 +67,8 @@ NSString * const kMGLDownloadPerformanceEvent = @"mobile.performance_trace";
}
- (void)startDownloadEvent:(NSString *)urlString type:(NSString *)resourceType {
- NSDate *startDate = [NSDate date];
if (urlString && ![self eventDictionaryForKey:urlString]) {
+ NSDate *startDate = [NSDate date];
[self setEventDictionary:@{ MGLStartTime: startDate, MGLResourceType: resourceType } forKey:urlString];
}
}
@@ -87,8 +87,11 @@ NSString * const kMGLDownloadPerformanceEvent = @"mobile.performance_trace";
NSString *urlString = response.URL.relativePath;
if (urlString && [self eventDictionaryForKey:urlString]) {
NSDictionary *eventAttributes = [self eventAttributesForURL:response withAction:action];
- [self.metricsDelegate networkConfiguration:self didGenerateMetricEvent:eventAttributes];
[self removeEventDictionaryForKey:urlString];
+
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [self.metricsDelegate networkConfiguration:self didGenerateMetricEvent:eventAttributes];
+ });
}
}