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

Decouple notifications websocket handling from chat operations #26724

Merged
merged 4 commits into from
Jan 29, 2024

Conversation

bdach
Copy link
Collaborator

@bdach bdach commented Jan 26, 2024

This is a prerequisite for #25480.

The WebSocketNotificationsClient was tightly coupled to chat specifics making it difficult to use in the second factor verification flow. This PR's goal is to separate the websocket connection and message handling concerns from specific chat logic concerns.

I apologise for the diff in advance, but extricating this out in a sane manner was difficult enough to begin with and I'm still not entirely happy with where things at. I had major trouble trying to decipher the reasoning behind the PersistentEndpointClient / PersistentEndpointClientConnector dichotomy, and I can't get rid of it without uprooting more stuff (and I do want to be using those because PersistentEndpointClientConnector has the nice retry logic that I would like the notification websocket to be using).

bdach added 3 commits January 25, 2024 14:47
This is a prerequisite for ppy#25480.

The `WebSocketNotificationsClient` was tightly coupled to chat specifics
making it difficult to use in the second factor verification flow.
This commit's goal is to separate the websocket connection and message
handling concerns from specific chat logic concerns.
while (!cancellationToken.IsCancellationRequested)
{
await api.PerformAsync(CreateInitialFetchRequest()).ConfigureAwait(true);
await Task.Delay(1000, cancellationToken).ConfigureAwait(true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get bad memories of call stacks getting infinitely longer with Task.Delay in a loop, but we've used it elsewhere since so maybe it's been fixed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't new code either, was just moved from old place of usage, so...

@peppy peppy merged commit 48fc054 into ppy:master Jan 29, 2024
@bdach bdach deleted the decouple-notification-websocket-from-chat branch January 29, 2024 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants