ios – Precedence inversion when calling URLSession add in Swift

0
8
ios – Precedence inversion when calling URLSession add in Swift


I attempted to add a video file to the distant server like the next:

Job {
    let (knowledge, res) = strive await withCheckedThrowingContinuation { continuation in
        let activity = URLSession(configuration: .ephemeral).uploadTask(with: request, fromFile: fileURL) { knowledge, response, error in
            if let response = response as? HTTPURLResponse {
                continuation.resume(returning: (knowledge, response))
            } else if let error {
                continuation.resume(throwing: error)
            }
        }
        activity.resume()
    }
    //deal with knowledge and res...
}

And Xcode warns:

Thread Efficiency Checker: Thread working at Consumer-initiated quality-of-service class ready on a decrease QoS thread working at Default quality-of-service class. Examine methods to keep away from precedence inversions
PID: ..., TID: ...
Backtrace
=================================================================
3   PhotosFormats                       0x00000001a5ff01c4 -[PFVideoAVObjectBuilder _synchronouslyLoadSlowMotionPropertiesFromAsset:] + 172
4   PhotosFormats                       0x00000001a5ff00a0 -[PFVideoAVObjectBuilder requestAVAssetForExport:withResultHandler:] + 224
5   Images                              0x00000001909d2428 +[PHImageManager(VideoUtilities) buildAVAssetFromVideoURL:infoDictionary:options:completion:] + 244
6   Images                              0x0000000190a686dc __63-[PHImageManager requestAVAssetForAsset:options:resultHandler:]_block_invoke_2 + 352
...

Seems like there’s something fallacious with requestAVAssetForAsset.

I attempted setting the duty precedence to 0, 0.4, 0.6, and 1, earlier than calling resume:

activity.precedence = 0
activity.resume()

Additionally tried altering the precedence of Job wrapper to .low, .excessive, and so on:

Job (precedence: .low) {
    ...
}

However it doesn’t work (nonetheless reveals warnings).

I’m wondering if there’s a strategy to keep away from precedence inversion when importing video file with URLSession add.

Edit:

Utilizing add with Information could not work for scenario during which video dimension is massive (as a result of it masses knowledge in reminiscence, right me if I’m fallacious)

LEAVE A REPLY

Please enter your comment!
Please enter your name here