pervane icon indicating copy to clipboard operation
pervane copied to clipboard

Redundant and missing auto-save calls

Open metanet opened this issue 5 years ago • 2 comments

  1. Start pervane with debugging enabled.
  2. Open a tab in the browser.
  3. Type a single letter and wait for the auto-save trigger.
  4. See the following logs:
INFO:werkzeug:127.0.0.1 - - [07/Jun/2020 23:31:40] "POST /api/update HTTP/1.1" 200 -
INFO:werkzeug:127.0.0.1 - - [07/Jun/2020 23:31:40] "POST /api/update HTTP/1.1" 200 -

For each letter, there are 2 POST calls. If you type 5 letters and wait for the auto-save, there will be 10 POST calls.

On the other hand, if you delete something in the editor, auto-save doesn't get triggered.

Last, if you save by ALT+S, there is only 1 POST call which is the correct behavior.

metanet avatar Jun 07 '20 20:06 metanet

We listen to change event. And 2 seconds after event is triggered, pervane issues the POST request.

Deletion sounds like a bug. However, first one is the auto save behavior.

What do you recommend instead?

hakanu avatar Jun 09 '20 21:06 hakanu

but there are 2 POST requests for each key store. Why is there a second POST? It seems like a bug to me.

Other than that, I think hitting disk for each key stroke is a bit overkill. When I hit 5 keys in 2 seconds before auto-save kicks in, the UI sends 10 POST requests, even if a single POST request would be enough. I think we can optimize this part.

metanet avatar Jun 10 '20 07:06 metanet