insanum / sncli

Simplenote CLI
MIT License
397 stars 34 forks source link

Starting sncli while disconnected from network results in all notes being deleted from disk. #8

Closed casutherland closed 9 years ago

casutherland commented 10 years ago

Starting sncli while disconnected from network results in all notes being deleted from disk.

The README speaks of two-way sync, so offline operation support was the expected behavior, with two-way sync once network connectivity was re-established. Are off-line operations not supported? If not supported currently, is off-line support planned in the future?

2014-09-11 17:51:37,475 [DEBUG] sncli logging initialized
2014-09-11 17:51:38,748 [DEBUG] Sync worker: started
2014-09-11 17:51:38,760 [DEBUG] Starting full sync
2014-09-11 17:51:38,777 [DEBUG] ERROR: Failed to get note list from server
2014-09-11 17:51:38,791 [DEBUG] Deleted note from disk (key=...)
...
insanum commented 10 years ago

Yikes. Yes this should work. Thanks for reporting and I'll look into this asap.

shawnaxsom commented 9 years ago

@insanum I had seen this issue as well in the past. Have you had a chance to look into this or shall I take a look?

insanum commented 9 years ago

Go for it. :-)

shawnaxsom commented 9 years ago

This issue should be fixed in the latest commit to master. I added in a variable/logic to skip trying to sync if the connection fails. It will show an error about the connection still, but it won't try to continue to sync and therefore try to delete local notes when it fails.

Temp file changes should be saved to disk correctly, and the note saved correctly, and the note will sync once the connection is restored.

insanum commented 9 years ago

Nice! ☺