From 6dbb93836888ad4b757553cd1e9b50cbc9ecd323 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 12 Jul 2015 00:43:20 -0700 Subject: [PATCH] Speed up app icon load time by 2 seconds by only waiting if it failed --- Limelight/Network/AppAssetRetriever.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Limelight/Network/AppAssetRetriever.m b/Limelight/Network/AppAssetRetriever.m index 58cef23..1fe102c 100644 --- a/Limelight/Network/AppAssetRetriever.m +++ b/Limelight/Network/AppAssetRetriever.m @@ -28,7 +28,9 @@ static const int MAX_ATTEMPTS = 5; appImage = [UIImage imageWithData:appAssetResp.data]; self.app.image = UIImagePNGRepresentation(appImage); - [NSThread sleepForTimeInterval:RETRY_DELAY]; + if (![self isCancelled] && appImage == nil) { + [NSThread sleepForTimeInterval:RETRY_DELAY]; + } } [self performSelectorOnMainThread:@selector(sendCallbackForApp:) withObject:self.app waitUntilDone:NO]; }