Automattic / simplenote-electron

Simplenote for Web, Windows, and Linux
https://app.simplenote.com
GNU General Public License v2.0
4.73k stars 556 forks source link

Revisons slider shows far fewer revisions than expected #2093

Open wezm opened 4 years ago

wezm commented 4 years ago

Expected

When viewing the revisions of a note with a lot of versions I expect the revisions slider to show quite a few revisions.

Observed

For example I have a note that was created Sat Nov 29 2014 01:29:04 GMT+1100 (Australian Eastern Daylight Time) with many versions.

Reproduced

  1. Visit a note with a lot of revisions, dating back some time
  2. Open the web inspector an observe the messages on the web socket
  3. Click the History icon for the note
  4. Observe many e entity request and response messages for all the versions of the note
  5. Slide the revisions slider and observe far fewer versions.

I've looked over the simplenote-electron code and simperium-node code but I've been unable to work out exactly why this is happening. However, most likely source of the bug to me would be the use of setTimeout when handing the version events in collectionRevisions. I am located in Australia and latency from here to the US where I assume Simplenote is hosted is typically 250 to 300ms:

$ ping api.simperium.com
PING simperium.com (192.0.84.247) 56(84) bytes of data.
64 bytes from 192.0.84.247 (192.0.84.247): icmp_seq=2 ttl=48 time=263 ms
64 bytes from 192.0.84.247 (192.0.84.247): icmp_seq=3 ttl=48 time=286 ms
64 bytes from 192.0.84.247 (192.0.84.247): icmp_seq=4 ttl=48 time=307 ms
64 bytes from 192.0.84.247 (192.0.84.247): icmp_seq=5 ttl=48 time=229 ms
64 bytes from 192.0.84.247 (192.0.84.247): icmp_seq=6 ttl=48 time=250 ms
64 bytes from 192.0.84.247 (192.0.84.247): icmp_seq=7 ttl=48 time=273 ms
64 bytes from 192.0.84.247 (192.0.84.247): icmp_seq=8 ttl=48 time=296 ms
64 bytes from 192.0.84.247 (192.0.84.247): icmp_seq=9 ttl=48 time=319 ms

I suspect that the TIMEOUT of 200ms is set too low for people that are far from the US. To reproduce perhaps try viewing revisions with Chrome's network throttling with additional latency added (E.g. Regular 2G):

Screenshot from 2020-05-16 10-42-05

Below are screenshots showing the messages on the websocket when clicking the History button on the website. These correspond to the request for revisions but the UI does not reflect them. You can see that most of the requested versions exist on the backend. I.e. they return an entity and not the missing entity response, ?.

Screenshot from 2020-05-16 10-13-52 Screenshot from 2020-05-16 10-14-05 Screenshot from 2020-05-16 10-14-21 Screenshot from 2020-05-16 10-14-33 Screenshot from 2020-05-16 10-15-04 Screenshot from 2020-05-16 10-15-14 Screenshot from 2020-05-16 10-15-22 Screenshot from 2020-05-16 10-15-30 Screenshot from 2020-05-16 10-15-39

dmsnell commented 4 years ago

@wezm thanks for the debugging. 200ms is definitely too short. revisions-fetching needs some work. we'll try and update it soon; maybe we can eliminate the timeout altogether