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

(question) Does FileSystemManager support uploading one file after the other (provided that each file-upload completes first) #209

Open
ksidirop-laerdal opened this issue Apr 17, 2024 · 1 comment

Comments

@ksidirop-laerdal
Copy link

ksidirop-laerdal commented Apr 17, 2024

Essentially what the title says. I'm trying to upload multiple file one after the other making sure that each next upload is submitted if and only if the previous has completed. However I realized that the FileSystemManager is completely frozen upon trying to upload the second file.

BUT if I dispose of the FileSystemManager and re-instantiate it from scratch then the uploads are performed normally as intended which is weird.

        _fileSystemManager = FileSystemManager(transporter: _transporter)
        _fileSystemManager.logDelegate = self

        var success = _fileSystemManager.upload(
                name: "/remote/file/path/here/1.txt",
                data: data1,
                delegate: self
        )
        if !success {
            return false
        }
        
        // wait for the first upload to complete
        
        success = _fileSystemManager.upload( // this one is submitted without errors but nothing happens - the file doesnt get uploaded at all
                name: "/remote/file/path/here/2.txt",
                data: data2,
                delegate: self
        )
        if !success { // success=true 
            return false
        }

If I switch over to this approach everything works:

        _fileSystemManager = FileSystemManager(transporter: _transporter)
        _fileSystemManager.logDelegate = self

        var success = _fileSystemManager.upload(
                name: "/remote/file/path/here/1.txt",
                data: data1,
                delegate: self
        )
        if !success {
            return false
        }
        
        // wait for the first upload to complete
                
        _fileSystemManager = FileSystemManager(transporter: _transporter)  // REINSTANTIATION
        _fileSystemManager.logDelegate = self

        
        success = _fileSystemManager.upload( // with this approach everything works flawlessly
                name: "/remote/file/path/here/2.txt",
                data: data2,
                delegate: self
        )
        if !success { // success=true 
            return false
        }

This works but it's not optimal. We should be able to reuse the original instance of FileSystemManager right?

Am I missing something?

ksidirop-laerdal added a commit to Laerdal/Laerdal.McuMgr that referenced this issue Apr 17, 2024
…ple files like we used to

   We now call disposeFilesystemManager() to force re-instantiating the fs-manager. This seems to resolve the 'hang' in question.

   I opened a question regarding this issue:

   NordicSemiconductor/IOS-nRF-Connect-Device-Manager#209
@dinesharjani
Copy link
Contributor

I'm guessing this use case was not tested. Can you submit a PR fix?

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

2 participants