URLSession, async/await, and priority

I noticed that the async/await methods on URLSession do not include any support for passing the priority of the requests like you can with URLSessionTask.priority. Is there any way to set the relative priority of these requests, or is that something that we shouldn't worry about?

Is there any way to set the relative priority of these requests?

No. This is one of those places where the historical design of URLSession, which allowed you to tweak tasks before calling resume() on them, is at odds with our convenient async wrapper )-: If setting the priority is important to you, per my comments below, you should definitely file a bug against URLSession.

If you do file a bug, please post your bug number, just for the record.

is that something that we shouldn't worry about?

That’s really for you to say. Request priority is most relevant when you use an older HTTP protocol, which suffer from the head-of-line blocking problem. With more modern HTTP versions — HTTP/2 but even more so for HTTP/3 — this is less of an issue.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

URLSession, async/await, and priority
 
 
Q