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

Need to handle failed uploads #5

Open
peircej opened this issue Jan 25, 2017 · 4 comments
Open

Need to handle failed uploads #5

peircej opened this issue Jan 25, 2017 · 4 comments
Labels

Comments

@peircej
Copy link
Member

peircej commented Jan 25, 2017

I find relatively often that uploading files is resulting in a requests timeout I don't know whether that's an issue with the OSF.io server or whether it's a problem with pyosf code.

What is definitely a problem currently with pyosf is that when this occurs the local database still thinks the file was successfully sent. When it then discovers that the file isn't there remotely it thinks the file has been deleted at the server and deletes the local copy too! This is obviously bad. We need to fix by:

  • only adding to the local database once file push reports success
  • and/or retest the status after the sync to make sure that the state of both local and remote is correct
@peircej peircej added the bug label Jan 25, 2017
@peircej
Copy link
Member Author

peircej commented Jan 25, 2017

@lindemann09 wanted to make sure you're aware of this issue, in the interests of not losing files! :-)

@peircej
Copy link
Member Author

peircej commented Jan 25, 2017

The key problem is around line 245 of sync.py :

        # when local/remote updates are complete refresh index based on local
        proj.local.rebuild_index()
        proj.index = proj.local.index

At the end of sync this is assuming that sync was successful and sets the proj.index (i.e. the database) to be the same as the local.index. We need, instead, to track proj.index and change it as we need to on each successful operation. That will be ugly but safer in a world where the sync operations can fail.

@lindemann09
Copy link
Contributor

lindemann09 commented Jan 25, 2017

Thanks for the update. I didn't have the problem yet, but I'll keep an eye on it.

@aubreymoore
Copy link

I am having the same problem: pyosf wants to delete files on my local machine following failed uploads which occur frequently out here on the fringes of the net (I live on Guam).

As a workaround to prevent data loss, I always do print(changes) to examine proposed changes prior to executing changes.apply(). If the proposed changes indicate that local files are to be deleted, I execute changes = proj.get_changes() and print(changes) again.

pyosf is a great tool and I hope this bug can be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants