-
Notifications
You must be signed in to change notification settings - Fork 272
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
defer: add a map_deferred_response
in rhai
#1219
Comments
I don't understand why rhai would need this function, but other plugins wouldn't. Is it to allow for async cancellation? The bit I'm struggling with is this: we'd never know (when we write a plugin) whether we should expect a query to have deferred elements or not, so preserving the current behaviour doesn't seem to yield much benefit. A plugin auther (rhai or otherwise) is always going to need to handle potentially deferred queries. |
rhai needs it because it is incapable of managing async code, and it won't have the same capabilities between the first response and the deferred ones: on the first response headers are still editable, while in deferred responses they will not. |
Presumably the ability to edit response headers in subsequent deferred responses will also not be possible with native Rust plugins. How will we handle that in |
in native plugins we can edit the headers, then map over the stream, and return a new response with the edited headers and the mapped stream |
Follows up on #1487 (comment) Related to #1219
Follows up on #1487 (comment) Related to #1219
rhai runs synchronously, so it cannot apply to all of the deferred responses at once. The current plan emerging from #1206 is to apply the current
map_response
behaviour on the headers and the first response (which should be directly available in most cases), then support another rhai callback that can be applied on deferred responses.In this way we keep the current behaviour for normal queries
The text was updated successfully, but these errors were encountered: