-
Notifications
You must be signed in to change notification settings - Fork 1
LRS-68 Handle Async Multipart Errors #78
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
milt
commented
May 5, 2022
kelvinqian00
reviewed
May 5, 2022
src/main/com/yetanalytics/lrs/pedestal/interceptor/xapi/statements/attachment/response.cljc
Show resolved
Hide resolved
kelvinqian00
reviewed
May 5, 2022
Contributor
|
Also don't forget to describe this revised behavior in the documentation. Probably advice best suited for the application level (since that's where the user docs are written), but since this will now apply to all apps that use this |
kelvinqian00
reviewed
May 6, 2022
kelvinqian00
approved these changes
May 6, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
LRS-68
Currently the async multipart body build fn simply omits nil attachments. It should instead make the multipart result invalid, since the status cannot be changed. It is also currently utilized for sync responses, which is extra overhead.Separating the sync and async approaches to building multipart responses (and testing them for parity) will let us have different behaviors WRT errors in mid-multipart on async.After more research, the universal (sync + async) use of a channel body is probably more desirable as it allows even sync implementations to return things like
Filefor attachment content which are passed for direct handling by pedestal.This leaves the problem with the current impl that it simply omits attachments when errors occur, rather than terminating the response (and thus returning an invalid multipart), which is the only indication a client will get that the response is invalid.
This PR modifies the two async body formation functions (json and multipart) to accept a
::lrsp/async-errorkeyword in lieu of a statement, attachment or header. Upon receiving it they will immediately close the stream.In practice this has no effect on sync impls like
lrsqlwhere an eager result is provided.See the multipart body tests for examples of early termination: https://github.com/yetanalytics/lrs/blob/bd55295491e33523dd0c83c5c86cedf6389c3025/src/test/com/yetanalytics/lrs/pedestal/interceptor/xapi/statements/attachment/response_test.cljc