insanum / sncli

Simplenote CLI
MIT License
396 stars 34 forks source link

Stop responding when syncing #80

Open 0000marcell opened 5 years ago

0000marcell commented 5 years ago

App stop responding for a moment after any edit The problem is related with syncing, when i disable automatic sync it works fine I love to solve the problem if someone could point me to the right direction

I'm on: OS: Arch Linux x86_64 Python 3.7.1

casutherland commented 5 years ago

Connected fine yesterday, 3/25, last log entries... (Aside: very chatty, is this wss, over https?)

...
2019-03-25 15:31:10,388 [DEBUG] Starting new HTTPS connection (1): api.simperium.com:443
2019-03-25 15:31:10,793 [DEBUG] https://api.simperium.com:443 "GET /1/chalk-bump-f49/note/index?data=1&limit=100&mark=5350795cba5fdc113dd61e28 HTTP/1.1" 200 164724
2019-03-25 15:31:11,046 [DEBUG] Starting new HTTPS connection (1): api.simperium.com:443
2019-03-25 15:31:11,487 [DEBUG] https://api.simperium.com:443 "GET /1/chalk-bump-f49/note/index?data=1&limit=100&mark=530cb9c4ba5fdc112970add3 HTTP/1.1" 200 159953
2019-03-25 15:31:11,942 [DEBUG] Starting new HTTPS connection (1): api.simperium.com:443
2019-03-25 15:31:12,380 [DEBUG] https://api.simperium.com:443 "GET /1/chalk-bump-f49/note/index?data=1&limit=100&mark=52c4aa04ba5fdc4e28601795 HTTP/1.1" 200 132333
2019-03-25 15:31:13,039 [DEBUG] Starting new HTTPS connection (1): api.simperium.com:443
2019-03-25 15:31:13,409 [DEBUG] https://api.simperium.com:443 "GET /1/chalk-bump-f49/note/index?data=1&limit=100&mark=527ae81cba5fdc4ed7fe2724 HTTP/1.1" 200 157176

Laptop resumed today, 3/26, the sncli app is responding, opened a note to edit...

2019-03-26 08:55:12,830 [DEBUG] EXECUTING: ['/usr/bin/vim', '/tmp/tmpx98q4bmm.txt']

After saving the updated note...

2019-03-26 09:27:23,201 [DEBUG] Note updated
2019-03-26 09:27:23,205 [DEBUG] Note content updated (key=833d6df8142a11e98c40d18243993991)

That is all, the app simply stops responding.

Meanwhile, I have taken to manually writing to a local tmp file anytime I use sncli. This issue and #82 might be related.

Next steps: will try to run connection management through a python debugger...

0000marcell commented 5 years ago

@qcu awesome work, i hope you find the cause of the problem

samuelallan72 commented 5 years ago

(Aside: very chatty, is this wss, over https?)

No - there are just many requests used during syncing...


Sorry I don't have much time to investigate these issues at the moment. There is a configuration option (cfg_tempdir) that you can set to somewhere persistent that may be helpful in preventing data loss. I'm not sure if or when sncli deletes the temporary file after saving though.

The freezing is almost definitely because of syncing. afaik everything runs in the same thread (or maybe not; urwid might do some magic?), so when a long sync runs, it blocks everything.