diff --git a/DVR/SessionDataTask.swift b/DVR/SessionDataTask.swift index 2757166..a620dd0 100644 --- a/DVR/SessionDataTask.swift +++ b/DVR/SessionDataTask.swift @@ -12,6 +12,7 @@ class SessionDataTask: NSURLSessionDataTask { weak var session: Session! let request: NSURLRequest let completion: Completion? + private let queue = dispatch_queue_create("com.venmo.DVR.sessionDataTaskQueue", nil) // MARK: - Initializers @@ -35,7 +36,11 @@ class SessionDataTask: NSURLSessionDataTask { // Find interaction if let interaction = cassette?.interactionForRequest(request) { // Forward completion - completion?(interaction.responseData, interaction.response, nil) + if let completion = completion { + dispatch_async(queue) { + completion(interaction.responseData, interaction.response, nil) + } + } return }