Fix blob attachment when using batches (Fixes #4166)#4192
Merged
Conversation
DLehenbauer
commented
Oct 30, 2020
| // If the batch contains only a single op, clear the batch flag. | ||
| if (messages.length === 1) { | ||
| delete messages[0].metadata; | ||
| delete firstMessageMetadata.batch; |
Contributor
Author
There was a problem hiding this comment.
First bug: should delete the 'batch: true' flag, not the entire message metadata.
DLehenbauer
commented
Oct 30, 2020
| // Set the batch flag to false on the last message to indicate the end of the send batch | ||
| const lastMessage = messages[messages.length - 1]; | ||
| lastMessage.metadata = { ...lastMessage.metadata, ...{ batch: false } }; | ||
| lastMessage.metadata = { ...lastMessage.metadata, batch: false }; |
Contributor
Author
There was a problem hiding this comment.
(Opportunistic cleanup... not a bug.)
DLehenbauer
commented
Oct 30, 2020
| batchBegin = true; | ||
| // eslint-disable-next-line no-param-reassign | ||
| opMetadata = { ...opMetadata, batch: true }; | ||
| this.needsFlush = true; |
Contributor
Author
There was a problem hiding this comment.
Second bug was replacing metadata with { batch: true } (below).
'batchBegin' flag was only used to determine whether to set { batch: true }.
Collaborator
■ @fluidframework/base-host: No change
⯅ @fluid-example/bundle-size-tests: +15 Bytes
Baseline commit: 87845fd |
DLehenbauer
commented
Oct 30, 2020
| content: any, | ||
| localOpMetadata: unknown, | ||
| opMetaData: unknown, | ||
| opMetadata: Record<string, unknown> | undefined, |
Contributor
Author
There was a problem hiding this comment.
'opMetadata' must be constrained to "map-like objects" to ensure we can merge.
(Also, opMetaData -> opMetadata)
wes-carlson
approved these changes
Oct 30, 2020
Contributor
Author
|
Thanks, @wes-carlson ! |
4 tasks
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
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.
When batching, the container runtime was clobbering the { blobId: * } metadata with { batch: true/false }.