简体   繁体   中英

How to organize background bulk download?

I'm trying to organize background download of multiple images (couple hundred) in the way that it will not freeze the main UI and I will be able to control number of simultaneous downloads.

First attempt was using serial dispatch queue, which failed due it will span threads although serially, but the sync download code in queue block will be executing simultaneously, thus producing number of errors(server will simply drop most of such connection).

The question is - how to organize this background download? Is it better to have fill dispatch queue with as many download jobs as server will bee comfortable, then write sync download routines in queue block and upon completion of download span other bulk?

Is there any better or more natural way to do that?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM