Next.js Discord

Discord Forum

Timing of cache revalidation through revalidateTag

Unanswered
Pacific anchoveta posted this in #help-forum
Open in Discord
Avatar
Pacific anchovetaOP
Are there any guidelines related to the timing or sequence within a request for when the data cache is marked to be revalidated?

Currently experiencing following scenario:

Within post route handler
1. revalidateTag(“tag”)
2. await sendPubSubToClient()

Client
3. client receives pubsub via websocket
4. client requests get route handler endpoint
5. client receives stale data from cache

However if I sleep for some random milliseconds between point 3 and 4 data will be revalidated OK

Does revalidateTag() call somehow get postponed until the response has been sent to client? Or are there some timing or sequences to know related to revalidating the cache? I could not find anything in the docs related to this.

Thanks!

0 Replies