Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancel all downloads does not immediately cancel #7

Open
Joohansson opened this issue Sep 20, 2018 · 0 comments
Open

Cancel all downloads does not immediately cancel #7

Joohansson opened this issue Sep 20, 2018 · 0 comments

Comments

@Joohansson
Copy link

I'm testing downloading 7000 small files (a tile map) and it works fine. The cancelAllDownloads() may not work as expected though. It cancel the download right away and currentDownloads() show 0. Problem is the phone CPU continues to draw 115% for another minute or so until I get lots of error messages:

Download_Test[8714:5096552] Task <BB99B5A0-D65B-48A1-B2DC-4BADF2FF14C7>.<2949> finished with error - code: -999
Download_Test[8714:5096552] Task <0D00795E-2B48-45EA-8A01-17223FDB1D52>.<1217> finished with error - code: -1001

999 means cancelled and 1001 means timeout. Starting a new download after this works but if I would cancel and then immediately start a new download it will not work very good. I get a lot of these in the console:
Download_Test[8714:5100848] TIC Read Status [34:0x1c456e640]: 1:57

Then it kind of freezes the app but eventually it continues by cancelling like above and at the same time tries to download which result in this error:
Error: Error Domain=NSPOSIXErrorDomain Code=24 "Too many open files"

It calm down eventually but it takes 10-15min this time and only a few files are downloaded.

Would it be possible to get the cancel to really cancel directly, alternatively tell me via some callback when the cancel has really cancelled, ie. urlsession timeout so I can block the user from starting a new download? How to shorten the timeout?

I also wonder if it's wise to download 7000 files in one go or if I should divide it up 100 files at a time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant