Permalink
Browse files

Log slow-resolving hosts + remove some common hosts

  • Loading branch information...
1 parent 2545890 commit 023d13fe79f31afacf368940e74f68d5c001e2c1 @cstigler cstigler committed Dec 31, 2015
Showing with 13 additions and 6 deletions.
  1. +12 −1 BlockManager.m
  2. +1 −5 HostImporter.m
View
@@ -296,7 +296,18 @@ - (NSArray*)ipAddressesForDomainName:(NSString*)domainName {
return @[];
}
- return [host addresses];
+ NSDate* startedResolving = [NSDate date];
+ NSArray* addresses = [host addresses];
+
+ // log slow resolutions
+ // TODO: present this back to the user somehow, even help them remove slow-resolving hosts?
+ NSDate* finishedResolving = [NSDate date];
+ NSTimeInterval resolutionTime = [finishedResolving timeIntervalSinceDate: startedResolving];
+ if (resolutionTime > 2.5) {
+ NSLog(@"Warning: took %f seconds to resolve %@", resolutionTime, host.name);
+ }
+
+ return addresses;
}
- (BOOL)domainIsGoogle:(NSString*)domainName {
View
@@ -36,7 +36,6 @@ + (NSArray*)commonDistractingWebsites {
@"netflix.com",
@"hulu.com",
@"buzzfeed.com",
- @"vimeo.com",
@"dailymotion.com",
@"collegehumor.com",
@"funnyordie.com",
@@ -63,9 +62,7 @@ + (NSArray*)newsAndPublications {
@"gothamist.com",
@"jezebel.com",
@"usatoday.com",
- @"nbcnews.com",
@"theonion.com",
- @"abcnews.go.com",
@"news.yahoo.com",
@"washingtonpost.com",
@"wsj.com",
@@ -76,11 +73,10 @@ + (NSArray*)newsAndPublications {
@"msnbc.com",
@"rt.com",
@"bloomberg.com",
- @"reuters.com",
@"aol.com",
@"drudgereport.com",
@"nationalgeographic.com",
- @"vice.com"
+ @"vice.com",
@"nypost.com",
@"chicagotribune.com",
@"msn.com",

0 comments on commit 023d13f

Please sign in to comment.