Reorder logging statement so that logging occurs before sending of request to avoid sending message to a zombie instance. fixes #600

This commit is contained in:
Blake Watters
2012-03-20 20:42:14 -04:00
parent 0d709dbc07
commit 175a90cabe
2 changed files with 2 additions and 4 deletions

View File

@@ -529,8 +529,6 @@ RKRequestMethod RKRequestMethodTypeFromName(NSString *methodName) {
_isLoading = YES;
// TODO: WTF? Why was this afterDelay in here???
// [self performSelector:@selector(didFinishLoad:) withObject:[self loadResponseFromCache] afterDelay:0];
[self didFinishLoad:[self loadResponseFromCache]];
} else {
@@ -539,7 +537,7 @@ RKRequestMethod RKRequestMethodTypeFromName(NSString *methodName) {
NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
errorMessage, NSLocalizedDescriptionKey,
nil];
NSError* error = [NSError errorWithDomain:RKErrorDomain code:RKRequestBaseURLOfflineError userInfo:userInfo];
NSError* error = [NSError errorWithDomain:RKErrorDomain code:RKRequestBaseURLOfflineError userInfo:userInfo];
_isLoading = YES;
[self performSelector:@selector(didFailLoadWithError:) withObject:error afterDelay:0];
}

View File

@@ -289,8 +289,8 @@ static const NSTimeInterval kFlushDelay = 0.3;
}
[self addLoadingRequest:request];
[request sendAsynchronously];
RKLogDebug(@"Sent request %@ from queue %@. Loading count = %ld of %ld", request, self, (long) self.loadingCount, (long) _concurrentRequestsLimit);
[request sendAsynchronously];
if ([_delegate respondsToSelector:@selector(requestQueue:didSendRequest:)]) {
[_delegate requestQueue:self didSendRequest:request];