Open codesinghanoop opened 7 years ago
I found the solution to the issue, Adding few code to the android files will solve the above issue. I made new thread
can i contribute?
@codesinghanoop Feel free to! I cannot devote any time to this project at the moment but maybe @cjdell or other contributors can take a look at your PR.
@johanneslumpe @cjdell I have sent you the pull request, please go through it.
@codesinghanoop Had the same problem and tried your PR. Works like a charm! Thank you.
No problem friend. @johanneslumpe @cjdell please review my PR, it's helpful.
is it possible that currently downloads block each other in that manner? That means only one download at a time. I have this impression but will investigate further.
No two parallel download will work. Second download will proceed after first download is done successfully.....
maybe we should start each download task in a separate thread? For android there is already a PR from @codesinghanoop https://github.com/itinance/react-native-fs/pull/254
@itinance Thanks for the reference sir..
If we would parallelize all download task with next release, some apps could get in trouble than maybe. For keeping backward compat i would suggest to add an optional separateThread-Mode. If this is true, the downloadTask would start in a separate thread, otherwise not.
Yes that's a good idea...
Hi guys, According to me we have to add a new thread to write(download) the file and my research says that would not affect other things. We are basically adding thread only for writing(downloading) the files.
And you use the code of your PR for this, right? https://github.com/itinance/react-native-fs/pull/254 Then i will speed it up in upcoming days to test and merge
Yes, sir right..
Ok thank you! I will do the same on iOS side and merge it then together with your PR. Tomorrow or on Monday.
cool :+1:
I will merge this in upcoming days, together with a solution for iOS also by my own. Thought i could do this much faster but it will take some days.
Yeah, no problem ..Thank you :)
Hi guys! Thanks for the research around this. It would be great to parallelize downloads.
@itinance, why do you think that parallelizing may cause issues on some devices?
Because multithreading is often a pain to debug. Also we don't know if any apps would come into trouble when downloads now would be run in parallel. But for next release i will add a note that we've changed the Download-Task to Threads now. /cc @a-koka
Anyway I just merged #254 for android. Need to do this also for iOS or someone wants to send a PR for it?
@itinance Has this been released yet? I am having the same issue when I use the react-native-fs
npm module.
is it for iOS or Android ?
Android for now (but I am hoping to include iOS later)
I'm assuming you are using current version of this lib. Please can you install v2.5 and let me know if you are still facing the same issue.
That fixed it! Thank you so much! Why is this not in the current version?
i don't know or may be some new functionality is destroying this. @itinance
I am using react-native fs to download the file. The react-native fs uses promises, so until the promise is returned back it keeps other async functions in a queue to execute. For instance, If i start downloading a file then other async functions(such as getting data from local storage) gets blocked. The other async function starts executing only when the download is complete.
any help would be appreciated.