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

Fixing broken websockets. #2770

Merged
merged 3 commits into from
Mar 1, 2023
Merged

Fixing broken websockets. #2770

merged 3 commits into from
Mar 1, 2023

Conversation

dessalines
Copy link
Member

I wrongly didn't test websockets with one of my recent PRs, this fixes it. It also removes a pointless to and from string conversion for the json data.

@dessalines dessalines requested a review from Nutomic as a code owner February 28, 2023 21:49
@@ -299,7 +302,7 @@ pub async fn match_websocket_operation_crud(
context: LemmyContext,
id: ConnectionId,
op: UserOperationCrud,
data: &str,
data: &Value,
Copy link
Member

@Nutomic Nutomic Feb 28, 2023

Choose a reason for hiding this comment

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

Cant you pass this by value (without &) and avoid using clone? I think it should work by calling get() and then take().

Copy link
Member Author

Choose a reason for hiding this comment

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

Got it, using .cloned() worked.

Copy link
Member

Choose a reason for hiding this comment

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

Cloned is the same as clone, it still copies data around unnecessarily.

@dessalines dessalines merged commit 3844ac7 into main Mar 1, 2023
dessalines added a commit that referenced this pull request Apr 26, 2023
* Fixing broken websockets.

* Use cloned() for serde::Value
Nutomic pushed a commit that referenced this pull request Apr 27, 2023
* Fixing broken websockets.

* Use cloned() for serde::Value
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