I have the issue that the cache isn’t up to date on later deployments. (This is not about CDN caching).
Consider this:
- deploy A saves specific file paths to cache via a netlify build plugin and utils.cache.sav
- later, deploy B and deploy C are triggered shortly after each other via webhook
- that means deploy B runs and deploy C is queued
- deploy B restores the cache from deploy A, builds normally, and also saves / updates the cache
- now deploy C starts, restores the cache, but instead of it being from deploy B, it’s still from deploy A
Question is: is this a bug or somehow expected behavior? I would expect that queued deployments always use the latest cache. I feel like this is a bug with queued deployments, because it does not happen if deployments run after each other without being queued.
Hi @Narretz,
I’ve asked the devs about this.
This is a known bug and something we intend to fix, but we don’t have a clear timeline of when that would happen exactly.
As a workaround (in case this is really important to you), you can introduce a delay between the builds being scheduled.
Hi @hrishikesh thanks for the answer and explanation. Unfortunately I cannot mark this as a solution, because I don’t think adding a delay is going to solve this problem. If I trigger multiple builds in a row I have no idea how long the delay must be because a) I don’t know how long the previous build will take and b) how long I must wait for the cache to be up to date.
The only solution I see here is to either use an external cache or for Netlify to fix this bug.
There’s sadly no timeline as to when this would be fixed, so I’m afraid this is what you’d have to rely on for now.