Background URLSession throttling while in foreground?

My app needs to upload some media files to a server. Usually it's only a few, but occasionally a user will have 1,000+ files to upload.

These files are user data and we want to maximize the chances of the files making it to the server, so we're using a background URL session to queue up the uploads.

However, what we're seeing is that for some users, the uploads just… stall. We're reconnecting to the background session, and the requests are all there; they're just not making any progress. This is true even when the app is in the foreground. I've configured the background URL session to use isDiscretionary = false, which I believe should indicate to the system that we really want these uploads to happen right away if possible.

If we switch to using a regular session instead of a background URL session, the uploads all go through just fine. What we'd like is for the uploads to go through just like a normal session while the app is in the foreground. When the app is quit, we'd love for the uploads to continue in the background at whatever rate the system chooses.

It seems to me that the system is throttling the uploads, even while the app is in the foreground. Is that something that happens with background URL sessions? Is there a way to make it not happen?

Here's how I'm configuring the URL session:

Code Block
let config = URLSessionConfiguration.background(withIdentifier: "my-custom-identifier")
config.isDiscretionary = false
config.allowsCellularAccess = true
config.sessionSendsLaunchEvents = false