Filesystem downloadAsync blocking asyncstorage interaction on Android

Hi all

I am currently writing an implementation of Filesystem with video downloads and local caching.

I am running into an issue with my reads and writes to Asyncstorage being blocked by video downloads.
As a workaround I need to pause all downloads, do my asyncstorage interactions and then resume the downloads.
This is happening only on Android, Ios has no issues running FileSystem downloads and asyncstorage queries concurrently.

Here is an example of my usage of downloadAsync:

//I initialize the download
let downloadResumable = FileSystem.createDownloadResumable(
          source,
          path,
          {},
          downloadProgress => this._downloadProgressHandler(downloadProgress)
        )
//Then I store the download in my queue
        downloadQueue[downloadIndex] = {
          source,
          id,
          name,
          path,
          download: downloadResumable,
          status: 'downloading',
          progress: 0
        }
//Then I start the download
        await downloadQueue[downloadIndex].download.downloadAsync()

After starting a download and doing a simple interaction with asyncstorage such as this :

await storage.get('cached-videos')

The promise returned by storage.get() will not resolve until the current active download is either paused or completed.

If this is a logic issue on my side fair enough, but it is strange that I’m experiencing this kind of blocking only on android.

Any insight from people who know more about Filesystem API than I do would be much appreciated!
Thanks a bunch!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.