joltup / rn-fetch-blob

A project committed to making file access and data transfer easier, efficient for React Native developers.
MIT License
2.8k stars 770 forks source link

Handle configs for each task individually rather than enumerating through all configs #558

Closed eschos24 closed 3 months ago

eschos24 commented 4 years ago

When downloading/uploading multiple blobs, the progress is only reported back for one task. This is because when a URLSession (iOS) is started, it uses the config based on a task id and, when it does this, it attempts to enable progress reporting for all other tasks, after which it removes the tasks from the dictionary of tasks to be enabled. Because of a race condition, this actually makes it so that only the first task for which progress reporting is enabled actually reports progress. This PR fixes that issue by handling this process on a case-by-case basis and only removes pending tasks after they have been moved to the dictionary of enabled tasks.

HorbachAndrii commented 2 years ago

exists another library in which fixed this issue https://github.com/RonRadtke/react-native-blob-util