atomic-server icon indicating copy to clipboard operation
atomic-server copied to clipboard

Outdated resource gap - how to make sure the front-end always shows latest version

Open joepio opened this issue 1 year ago • 0 comments

In the CI, some E2E tests were failing - all of them related to websockets. The second window was showing outdated resources.

Cause (unverified)

  • A commit is processed for a new Resource A
  • Resource A is opened in a new window
  • Resource A is included in the HTML of the page by the server
  • A commit is processed for Resource A'
  • When the page is rendered and the JS has executed, a SUBSCRIBE message is sent to the server
  • The client does not receive the A' commit, and only knows resource A.

Possible fixes

Include last-commit in SUBSCRIBE calls

  • Client (optionally) includes the last-commit in SUBSCRIBE message
  • Server checks if this is indeed the latest commit for that resource
  • If false, the server sends an RESOURCE message to the client with the latest version.

Add a timeout in the E2E tests

  • Quick 'n Dirty fix, doesn't address the underlying problem

Combine GET and SUBSCRIBE messages

  • Instead of doing a GET and a subsequent SUBSCRIBE, just do a SUBSCRIBE and that returns the full Resource

joepio avatar Nov 14 '23 12:11 joepio