Skip to content

Commit

Permalink
Cleaned up and improved middleware output (#76)
Browse files Browse the repository at this point in the history
Minimal cleanup of verbose output for debugging purposes.
  • Loading branch information
eneko authored Aug 30, 2018
1 parent 43fbc1c commit c25fa79
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- Allow direct manipulation of XML trees by converting XML and XMLNode from struct to class.

#### Enhancements
- None
- Improved verbose logging for middleware pipeline.

#### Bug Fixes
- None
Expand Down
18 changes: 6 additions & 12 deletions Sources/Conduit/Networking/URLSessionClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,28 +135,22 @@ public struct URLSessionClient: URLSessionClientType {

serialQueue.async {

// First, check if the queue needs to be evicted and frozen

logger.verbose("About to scan middlware options")
logger.verbose("Scanning middlware options ⌛︎")

for middleware in self.requestMiddleware {
if middleware.pipelineBehaviorOptions.contains(.awaitsOutgoingCompletion) {
logger.verbose("=============== WAIT ===============")
logger.verbose("Pausing session queue")

logger.verbose("Paused session queue ⏸")
_ = self.activeTaskQueueDispatchGroup.wait(timeout: DispatchTime.distantFuture)

logger.verbose("Resuming session queue")
logger.verbose("--------------- RESUME -------------")
logger.verbose("Resumed session queue ▶️")
}
}

logger.verbose("Finshed scanning middleware options")
logger.verbose("Finished scanning middleware options")

// Next, allow each middleware component to have its way with the original URLRequest
// This is done synchronously on the serial queue since the pipeline itself shouldn't allow for concurrency

logger.verbose("About to process request through middleware pipeline")
logger.verbose("Processing request through middleware pipeline ⌛︎")

let middlewareProcessingResult = self.synchronouslyPrepareForTransport(request: request)

Expand All @@ -176,7 +170,7 @@ public struct URLSessionClient: URLSessionClientType {
modifiedRequest = request
}

logger.verbose("Finished processing request through middleware pipeline")
logger.verbose("Finished processing request through middleware pipeline")

// Finally, send the request
// Once tasks are created, the operation moves to the connection queue,
Expand Down

0 comments on commit c25fa79

Please sign in to comment.