Przeglądaj źródła

Don’t clutter logs with NSURLConnection cancelations that occur before willSendRequest:…

These happen quite often and don’t really count as network traffic since they never actually hit the network.
Ryan Olson 11 lat temu
rodzic
commit
33d2667c99

+ 4 - 8
Classes/Network/PonyDebugger/FLEXNetworkObserver.m

@@ -912,15 +912,11 @@ didBecomeDownloadTask:(NSURLSessionDownloadTask *)downloadTask delegate:(id <NSU
     [self performBlock:^{
     [self performBlock:^{
         NSString *requestID = [self requestIDForConnection:connection];
         NSString *requestID = [self requestIDForConnection:connection];
 
 
-        // Errors can occur prior to the willSendRequest:... delegate call. In those cases, let the recorder know about the request before logging the failure.
-        NSURLRequest *request = [self requestForConnection:connection];
-        if (!request) {
-            request = connection.currentRequest;
-            [self setRequest:request forConnection:connection];
-            [[FLEXNetworkRecorder defaultRecorder] recordRequestWillBeSentWithRequestId:requestID request:request redirectResponse:nil];
+        // Cancellations can occur prior to the willSendRequest:... NSURLConnection delegate call.
+        // These are pretty common and clutter up the logs. Only record the failure if the recorder already knows about the request through willSendRequest:...
+        if ([self requestForConnection:connection]) {
+            [[FLEXNetworkRecorder defaultRecorder] recordLoadingFailedWithRequestId:requestID error:error];
         }
         }
-
-        [[FLEXNetworkRecorder defaultRecorder] recordLoadingFailedWithRequestId:requestID error:error];
         
         
         [self connectionFinished:connection];
         [self connectionFinished:connection];
     }];
     }];