-
Notifications
You must be signed in to change notification settings - Fork 275
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
examples(rhai): Building surrogate cache keys #648
Comments
a
returns cache-key: one-way
and subgraph b
returns cache-key: or-another
, and the response key returned to the client is surrogate-cache-key: one-way,or-another
right now we do not store response headers anywhere and have not thought about how and where they could be stored, so I propose we put off this example until we solve that |
this should be doable now that rhai plugins have access to subgraph response headers |
Looking forward to this example, I'm not seeing subgraph response headers in any of the rhai plugin response objects |
Most responses expose I'm going to guess that the existence of In a |
Hey thanks for the reply! For some reason fn subgraph_service(service, subgraph) {
const response_callback = Fn("process_response");
service.map_response(response_callback);
}
fn process_response(response) {
print(`${response.headers}`);
} In our case the goal is to propagate a few specific headers from subgraph responses. |
Three options:
I'll work through them and see if I can figure out what is happening. |
And the winner is:
I've raised #1094 and will look into this. |
@garypen nice work! thank you |
Let's get an example using Rhai script that allows building a surrogate response cache key from subgraph responses. e.g.:subgraph
a
returnscache-key: one-way
and subgraphb
returnscache-key: or-another
, and the response key returned to the client issurrogate-cache-key: one-way,or-another
blocked by #661
Worth noting that CAN actually be done as a Rust plugin today, but we just want to make it more simple and allow it in Rhai.
The text was updated successfully, but these errors were encountered: