-
-
Notifications
You must be signed in to change notification settings - Fork 753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add build cache settings #1669
Conversation
✅ Deploy Preview for asyncapi-website ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
This reverts commit 00eaff8.
This reverts commit ee8c4c1.
Signed-off-by: Sambhav Gupta <[email protected]>
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-1669--asyncapi-website.netlify.app/ |
can you explain what you added and why and basing on what docs? also, why we need netlify cli in the |
I went through the netlify blogs and found that we need to install the plugins for nextjs site deployed on netlify to enable caching
Sorry I forgot to mention I need to check the deploy status so needed to install it .I will remove it before the final merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you just need netlify cli for local testing then just remove it not and use it through npx
netlify.toml
Outdated
@@ -1,6 +1,7 @@ | |||
[[headers]] | |||
for = "/*" | |||
[headers.values] | |||
Cache-Control = "public, max-age=3600" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the scope of the issue is to enable cache for build,
why is this header added? what will it change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is added to control how caching should be performed
The value public, max-age=3600
specifies that the response can be cached by both public and private caches
,and the caching age is 3600 seconds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes but how is it helping with cache build? this is a setting for the server and client side caching. So imho totally unrelated and probably something we should not add
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well it just tell the server how long the response should be considered fresh and cacheable.So we can remove it as it doesn't help us that much in build
nice I was worried what would be the outcome :) |
Signed-off-by: Sambhav Gupta <[email protected]>
@derberg PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added the comments
netlify.toml
Outdated
@@ -1,6 +1,7 @@ | |||
[[headers]] | |||
for = "/*" | |||
[headers.values] | |||
Cache-Control = "public, max-age=3600" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is added to control how caching should be performed
The value public, max-age=3600
specifies that the response can be cached by both public and private caches
,and the caching age is 3600 seconds
netlify.toml
Outdated
@@ -1,6 +1,7 @@ | |||
[[headers]] | |||
for = "/*" | |||
[headers.values] | |||
Cache-Control = "public, max-age=3600" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes but how is it helping with cache build? this is a setting for the server and client side caching. So imho totally unrelated and probably something we should not add
@derberg all the things are done form my side , |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sambhavgupta0705 lgtm, just update description that this PR fixes linked issue so it is closed after merge
@akshatnema anything from your side?
@derberg My concern over the implementation is that aren't we targeting the |
@akshatnema this PR and related issue is focused on build cache, not website cache. It is not focused on website performance after deployment but the build performance and its speed. In other words, this PR enables cache inside Netlify build cache, to cache not only posts.json but also other source files, to speed up website rebuild. So website is not faster thanks to this PR. What is faster is the rebuild of for example preview in the PRs and contribution flow is improved |
@derberg Yeah, I completely understand that it is not building in any cache inside website runtime, but it should build a cache for posts.json and shouldn't run the build of the posts.json every time the build has been initiated. Also, I see the following error regarding the npm packages: So, probably, we have to upgrade the node version of Netlify. @sambhavgupta0705 You have to use Node v16.15.0 and npm v8.5.5 here. |
@sambhavgupta0705 the change needs to be done in @akshatnema regarding |
@derberg For now, I can't able to find anything in the Netlify docs to cache any existing files. Hope we had any CMS or DB for the posts in future so that we can set some caching regarding those in future. So approved ✅ |
@sambhavgupta0705 Kindly resolve the conflicts. |
Signed-off-by: Sambhav Gupta <[email protected]>
@akshatnema done 👍🏻 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
/rtm |
Description
Related issue(s)
fixes #843