Skip to content
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

Merged
merged 5 commits into from
Aug 26, 2024

Conversation

anitarua
Copy link
Contributor

@anitarua anitarua commented Aug 22, 2024

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.

@anitarua anitarua changed the title feat: add sequence number to TopicItem feat: add sequence number to TopicItem and add optional onDiscontinuity callback Aug 22, 2024
@anitarua anitarua marked this pull request as ready for review August 22, 2024 20:38
@anitarua anitarua requested a review from a team August 22, 2024 20:39
Copy link
Contributor

@cprice404 cprice404 left a 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) {
Copy link
Contributor

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?

Copy link
Contributor Author

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;
        }))));


constructor(_value: string | Uint8Array, options?: TopicItemOptions) {
constructor(
Copy link
Contributor

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.

@cprice404 cprice404 merged commit f3e940b into main Aug 26, 2024
13 checks passed
@cprice404 cprice404 deleted the topics-additions branch August 26, 2024 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants