-
Notifications
You must be signed in to change notification settings - Fork 42
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
fix: use correct shard index when creating encoder #1885
Conversation
size-limit report 📦
|
31275b0
to
ac16ae8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand this right, the issue arises as 0
is considered to be false
by JavaScript.
If that's the case, we should add a check to handle 0 gracefully, instead of making the type optional (which leads to cases where we have to enforce it's definition by adding !
)
Is that a fair interpretation? @adklempner
@danisharora099 The reason I made the |
ac16ae8
to
52c53a5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems fine to me
59f8146
to
b58a9e9
Compare
b58a9e9
to
9514653
Compare
Problem
When library consumer specifies a cluster ID and shard index when creating an encoder, it means they are using static sharding and explicitly specifying which shard index (and thus pubsub topic) should be used.
Currently, when an encoder is created this way, it uses the autosharding algorithm to determine the shard index based on content topic, which can lead to unexpected results if it doesn't match the shard index specified by the consumer.
Solution
shard
property optional inSingleShardInfo
.shard
is set to0
(this was preventing static sharding from being used)Notes