cpbotha/nvpy

Freeze when restarting nvpy before synchronization is complete

Closed this issue · 1 comments

When offline, simplenote v2.1.2 breaks on-memory database of nvpy.

nvpy 1.2.2-dev (6ef839a)

# nvpy.patch
diff --git a/nvpy/notes_db.py b/nvpy/notes_db.py
index 9d1c4a0..5fcd162 100644
--- a/nvpy/notes_db.py
+++ b/nvpy/notes_db.py
@@ -1009,7 +1009,12 @@ class NotesDB(utils.SubjectMixin):
 
         try:
             self.waiting_for_simplenote = True
+            print('before')
+            print(note)
             o, err = self.simplenote.update_note(note)
+            print('after')
+            print(note)
+            print('')
             self.waiting_for_simplenote = False
 
             if err == 0:
# stdout/stderr
$ nvpy
before
{u'modifydate': 1557121156.691686, u'tags': [], u'createdate': 1557121151.788488, u'syncdate': 0, u'content': u'new note created when offline', u'savedate': 1557129998.903475}
after
{u'tags': [], 'deleted': False, 'shareURL': '', u'syncdate': 0, 'systemTags': [], u'content': u'new note created when offline', u'savedate': 1557129998.903475, 'publishURL': '', 'modificationDate': 1557121156.691686, 'creationDate': 1557121151.788488}


ERROR: An unexpected error occurred.
... omitted ...
$ python
Python 2.7.16 (default, Apr  6 2019, 01:42:57) 
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import simplenote
>>> sn = simplenote.Simplenote('user', 'passwd')
>>> note = {'modifydate': 2.0, 'createdate': 1.0, 'tags': [], 'content': 'note'}
>>> sn.update_note(note)
(URLError(gaierror(-3, 'Temporary failure in name resolution'),), -1)
>>> note
{'tags': [], 'deleted': False, 'shareURL': '', 'systemTags': [], 'content': 'note', 'publishURL': '', 'modificationDate': 2.0, 'creationDate': 1.0}
>>>