atomic-server
atomic-server copied to clipboard
Outdated resource gap - how to make sure the front-end always shows latest version
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
SUBSCRIBEmessage 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-commitinSUBSCRIBEmessage - Server checks if this is indeed the latest commit for that resource
- If false, the server sends an
RESOURCEmessage 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
GETand a subsequentSUBSCRIBE, just do aSUBSCRIBEand that returns the full Resource