Revalidate on SSE canceled continuously in a high latency environment #8659
Unanswered
jason0598647
asked this question in
Q&A
Replies: 1 comment 4 replies
-
You will have to increase the time you use to trigger the revalidation so instead of (e.g.) revalidating every 100ms do it every 500ms. Another option as you mentioned is to instead of triggering a revalidation to pass the new data when it changes. Ideally instead of using SSE to trigger a revalidation every 100ms or any other amount of time, you should trigger the revalidation when data changed, if you wanted to trigger in an interval you could do it client-side and you can control it better, the benefit of using SSE or WebSockets is to only do it when data actually changed. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I have followed the SSE tutorial from here: https://www.youtube.com/watch?v=_7yJEC124jM
And adapted the source of the events to a Socket.IO API on the server side. When the server detects a change from the events API, it will send a timestamp SSE and the client will revalidate. The loader is just doing a GET of a list of instances from a local REST API on the server.
When working with low latency, ie. same geographic location, it works fine. I see the list component update various states as instances are updated. However, when I test from US West to AU East, I start running in to the following issue: (latency is probably around 450ms)
The list component is showing a bunch of tasks that run every minute (up to 50 on a page), and for the first 15 seconds or so of each minute they are continually updating their status as they start/stop. However in the higher latency test, the page never updates as page loads are being continually canceled until the page data is back in the original state.
Is there anyway to optimize the revalidate process to handle higher latency with frequent updates like this?
I'm thinking I may need to not use revalidate for this component and instead just push the field updates to the client for it to store in client cache instead.
(I'm on v2.5.1)
Here's a sample of the EventStream:
Beta Was this translation helpful? Give feedback.
All reactions