-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat: add sequence number to TopicItem and add optional onDiscontinuity callback #1418
Conversation
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.
overall looks great, just a few nits/questions
@@ -238,16 +239,24 @@ export class PubsubClient extends AbstractPubsubClient<ServiceError> { | |||
options.subscription | |||
); | |||
} | |||
} else if (resp?.heartbeat) { | |||
} else if (resp.heartbeat) { |
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.
this is interesting, why did this change? Just shouldn't have had the ?
in the first place?
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.
Yeah, I inspected the type (_SubscriptionItem
) when I saw that and I think resp
will never be undefined; just that it may not contain any data if something goes wrong, and that would be handled by the else
case.
constructor(data?: any[] | ({} & (({
item?: _TopicItem;
discontinuity?: never;
heartbeat?: never;
} | {
item?: never;
discontinuity?: _Discontinuity;
heartbeat?: never;
} | {
item?: never;
discontinuity?: never;
heartbeat?: _Heartbeat;
}))));
packages/core/src/internal/clients/pubsub/AbstractPubsubClient.ts
Outdated
Show resolved
Hide resolved
packages/core/src/internal/clients/pubsub/AbstractPubsubClient.ts
Outdated
Show resolved
Hide resolved
|
||
constructor(_value: string | Uint8Array, options?: TopicItemOptions) { | ||
constructor( |
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.
This is technically a breaking change to this constructor but I don't expect anyone external to be constructing these, so I think what you've done here is probably the best way to go.
Work towards https://github.com/momentohq/dev-eco-issue-tracker/issues/973
Tested new onDiscontinuity callback locally using a stubbed topics service that returns only discontinuities.