insanum / sncli

Simplenote CLI
MIT License
397 stars 34 forks source link

New note lost after creation due to connection problem #82

Open casutherland opened 5 years ago

casutherland commented 5 years ago

After creating a new note, there was apparently an internet connection issue and the note was never saved, locally or remote. Complete data loss.

Perhaps, we need to visit the local temporary persistence (store and forward) mechanism, in order to further reduce data loss in the event of a network disconnection?

sobjornstad commented 5 years ago

Just want to say I've experienced similar issues where sncli locks up when I save and exit my editor, and the content is lost. I've had to start writing out a backup copy before leaving my editor if I've made major changes. I would like to see sncli place the temporary file in a location where it will be saved if anything untoward happens.

samuelallan72 commented 5 years ago

@sobjornstad

I would like to see sncli place the temporary file in a location where it will be saved if anything untoward happens.

The temporary file location is customizable with the cfg_tempdir option, so you can set it to a persistent location if you like. By default it is /tmp/, so if sncli has crashed, you can still recover the note (unless the OS has rebooted).

samuelallan72 commented 5 years ago

...although it probably would be good to investigate when these tempfiles are deleted by sncli - it would be good to have them around for longer.

sobjornstad commented 5 years ago

Hmm, I seem to remember looking for it in /tmp and not finding it, but the last time I tried was a while ago. I'll take a closer look if it happens again.

samuelallan72 commented 5 years ago

I'm treating this as a high priority bug now. Data loss is no joke and this has affected enough people now. Obviously it is possible for the temporary file to be removed before a note is successfully saved in sncli's database or synced. I'll aim to look into it when I have time this week. If anyone else can see where the issues are and would like to open a WIP pull request or comment here, that would be appreciated. :)

casutherland commented 5 years ago

Thanks. Running the branch PR #90 locally now, and already appreciating the increased reliability.