-
Notifications
You must be signed in to change notification settings - Fork 2
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
fix(headerinterpreter): use custom interpreter #774
Conversation
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.
Hmm I am quite confused about this PR :(
github will tell us if the old etag value is outdated or not (ie, return 200) but we have opted to remove this behaviour and revalidate.
if we are invalidating on every API call, how exactly is the etag the same for 60 secs ah? wouldnt every call invalidate the sha already?
usage of a custom headerInterpreter - the change made compared to the default one is that we don't use the maxAge property on the request and instead default to a mustRevalidate behaviou
hmm checking in, you mean maxAge
property on the response right?
the
oops, yes! |
[test]: lets run e2e on this! i think the command is !run-e2e iirc? |
sadly it's only available on the frontend. we'd have to push this to |
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 for the explanation offline, this makes sense to me now!
test run here, will double check for any bugs prior to merge |
double checked failing test cases - all pass manually |
Problem
Currently, Isomer uses a huge amount of tokens due to not caching. This leads to scaling issue, where our github token limits are quickly reached and users are unable to access the CMS.
Closes IS-172
Solution
axios-cache-interceptor
to utilise ETags for cache. See here for info on etags.maxAge
header ((in this case, 60s) but we have opted to remove this behaviour and revalidate. this is to avoid github returning 409s when we attempt to update using the oldsha
headerInterpreter
- the change made compared to the default one is that we don't use themaxAge
property on the request and instead default to amustRevalidate
behaviourTests
console.log
forremainingRequests
intorespHandler
forAxiosInstance.ts
, so that we know how much requests are remainingGET
request to thee2e-test-repo
's homepage (curl --request GET \ --url http://localhost:8081/v2/sites/e2e-test-repo/homepage
)New dependencies:
axios-cache-interceptor
: interceptor for axios to use etags. the current backing storage is in memory.Deploy notes
axios
got upgraded from0.21.x
to0.25.0
0.9.2
as a minimum foraxios-cache-interceptor
ETag
functionality only added in0.6
+ their import forobject-code
is an outdated one, which doesn't get fixed till0.9.2
.from @kishore03109 I remember testing this locally prior during the approval process + no good way to test this in staging