Skip to content

refactor: use Client instance by reference #141

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

Merged
merged 2 commits into from
May 21, 2025
Merged

refactor: use Client instance by reference #141

merged 2 commits into from
May 21, 2025

Conversation

2bndy5
Copy link
Collaborator

@2bndy5 2bndy5 commented May 21, 2025

This moves async fn out of trait declaration to allow using Client instance passed by reference.

This avoids cloning the Client instance which can be costly to CPU and memory.

This moves async fn out of trait declaration to allow using `Client` instance passed by reference.

This avoids cloning the `Client` instance which consequently created a new connection to the same domain.
Copy link

codecov bot commented May 21, 2025

Codecov Report

Attention: Patch coverage is 94.39252% with 6 lines in your changes missing coverage. Please review.

Project coverage is 97.53%. Comparing base (49a7c8d) to head (1742cad).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
cpp-linter/src/rest_api/mod.rs 89.65% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #141      +/-   ##
==========================================
- Coverage   97.58%   97.53%   -0.05%     
==========================================
  Files          14       14              
  Lines        3430     3406      -24     
==========================================
- Hits         3347     3322      -25     
- Misses         83       84       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@2bndy5
Copy link
Collaborator Author

2bndy5 commented May 21, 2025

I think the proper way would be to use tokio's async channels, but we're not doing a massive amount of REST API work here.

@2bndy5
Copy link
Collaborator Author

2bndy5 commented May 21, 2025

The lines missing coverage were uncovered before this. Coverage went down slightly because the reformatted source has fewer total lines.

@2bndy5 2bndy5 marked this pull request as ready for review May 21, 2025 07:26
also ensure log messages are flushed to stdout (while mutex is locked)
@2bndy5 2bndy5 merged commit 851a435 into main May 21, 2025
40 of 42 checks passed
@2bndy5 2bndy5 deleted the no-client-clone branch May 21, 2025 20:33
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.

1 participant