Cancel check update task

Summary:
When call `[RCTDevMenu invalidate]`, it will cancel updateTask. But in fact, after the `[updateTask cancel]`, the updateTask's completionHandler will call `checkForUpdates` again, so it will create a new updateTask.
Closes https://github.com/facebook/react-native/pull/6165

Differential Revision: D3669576

Pulled By: javache

fbshipit-source-id: 443924b7f4be1716797fc5690e90d962cf31b923
This commit is contained in:
wenzhao.yin 2016-08-04 07:07:27 -07:00 committed by Facebook Github Bot 5
parent 523102b8e8
commit 223bcd74ad
1 changed files with 4 additions and 4 deletions

View File

@ -659,8 +659,6 @@ RCT_EXPORT_METHOD(reload)
}
if (_updateTask) {
[_updateTask cancel];
_updateTask = nil;
return;
}
@ -675,8 +673,10 @@ RCT_EXPORT_METHOD(reload)
if (!error && HTTPResponse.statusCode == 205) {
[strongSelf reload];
} else {
strongSelf->_updateTask = nil;
[strongSelf checkForUpdates];
if (error.code != NSURLErrorCancelled) {
strongSelf->_updateTask = nil;
[strongSelf checkForUpdates];
}
}
}
});