When I test the Netlify build locally, images are cached.
I believe this could be happening because the build isn’t finishing in a specified time limit? Is there a way we can increase the timeout limit for this site to see if the image folder is eventually fully cached?
Or any other advice would be appreciated.
I can provide the full build log if need be, it was too long to add to this post.
Thanks very much @hrishikesh! The build completes without any errors now, and I think the images are being cached. The first ‘clear cache’ build took around 25 mins, since the build time limit increase.
Should I be worried that it said Cache file count: 3753? This is just the .cache directory (3753 files).
The dist/images folder contains all the images required (8101 files) but they’re not reported in cache stats.
However when I ran the build a second time, since the time limit increase, it took 1 minute 20 seconds! Which is amazing.
I’m just confused as to why the images aren’t recognised in the cache stats or in cache-output.json
Ahh that makes sense, thanks @hrishikesh… One last question; is there a way we can specify the age of cached items?
It seems every now and then, the deploy process loses track of the images it needs and reverts to re-fetching everything, taking around 17 mins to build. Then the next few builds immediately after that are back to taking 1-3mins…
Or do you have any idea on what kind of code changes would cause all files to be re-downloaded? Realise this could also be an 11ty specific problem.
Hi @jrh I would have to see a deploy URL or deploy ID for your site where you have seen a 17 minute build time to be certain, but this does sound like a config setting where the images are marked for refresh which causes them to be re-downloaded.
Not sure why that build takes longer, to be honest. I can see, Eleventy take up 15 min of that build time, but why, that I do not know. It doesn’t seem to mention doing anything about the images in that build log (but does mention a lot about .html and .njk files). Why do you think it has something to do with the images not being cached? Maybe the next 2 builds were faster because they could use the data from .cache folder?
So during the Eleventy build it fetches images before writing any template files (.html and .njk). I believe that is where the delay is caused.
I can only compare it to what I test locally, both running 11ty or Netlify builds. The only time the build takes nearly this long locally is when it is done cold and has no template or image cache to reference…
To add: if i run netlify build locally with Eleventy in debug mode and no cache, it appears to be the lack of image cache that causes a similar lengthy build time.