Repository navigation
Conversation
Owner
Author
|
Closed as NOT-STREAM. Every streaming duration is in a proto-backed record, so it never goes through the JSON converter. |
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.
What changed?
This PR gives each Python model of a WIT-only record that holds a
duration, at any depth, a transfer type converter. It encodes thetimedeltaas a proto3 JSON duration, such as"1.5s", and decodes it back.Why?
The SDK JSON converter can't encode a
timedelta, so a call with a duration set failed with "Object of type timedelta is not JSON serializable".How did you test it?
The
stream-servicesample'sread-recordstakeswait: option<duration>again, in place ofwait-ms. Themodels.pygolden shows the converter onCreateStreamRequestandReadRecordsRequest. The long-poll sample test now sends atimedeltawait on each page through the data converter.Open question: TypeScript sends
common.Durationas the caller gives it (a string such as"1.5s"or a number of milliseconds), and .NET sendsSystem.TimeSpanin theSystem.Text.Jsonform ("00:00:01.5000000"). The two disagree, so this PR uses the proto3 form, which TypeScript strings such as"1.5s"match.Based on fork PR #57.