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

[PM-6104] Add locking support to bitwarden-json to improve bindings thread safety #591

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

dani-garcia
Copy link
Member

Type of change

- [ ] Bug fix
- [ ] New feature development
- [x] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other

Objective

I've added the lock into bitwarden-json because we already do locking in bitwarden-wasm and this way we can remove it from there.

@dani-garcia dani-garcia requested a review from Hinton February 7, 2024 16:08
@dani-garcia dani-garcia changed the title Add locking support to bitwarden-json to improve bindings thread safety [PM-6104] Add locking support to bitwarden-json to improve bindings thread safety Feb 7, 2024
Copy link

codecov bot commented Feb 7, 2024

Codecov Report

Attention: 28 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (main@1595306). Click here to learn what that means.

Files Patch % Lines
crates/bitwarden-json/src/client.rs 0.00% 20 Missing ⚠️
crates/bitwarden-py/src/client.rs 0.00% 3 Missing ⚠️
crates/bitwarden-wasm/src/client.rs 0.00% 3 Missing ⚠️
crates/bitwarden-c/src/c.rs 0.00% 1 Missing ⚠️
crates/bitwarden-napi/src/client.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #591   +/-   ##
=======================================
  Coverage        ?   57.79%           
=======================================
  Files           ?      168           
  Lines           ?     9907           
  Branches        ?        0           
=======================================
  Hits            ?     5726           
  Misses          ?     4181           
  Partials        ?        0           

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

@bitwarden-bot
Copy link

Logo
Checkmarx One – Scan Summary & Detailsefca8002-548b-4cc3-8af9-d11127a2576d

No New Or Fixed Issues Found

@@ -44,41 +45,43 @@ impl Client {
}
};

let mut client = self.0.lock().await;
Copy link
Member

Choose a reason for hiding this comment

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

Bit un-intuitive that we never have to release the lock and it's handled on drop.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, most locks in Rust follow that pattern of release on drop, though you can always make an explicit drop(client);

@dani-garcia dani-garcia merged commit 400a173 into main Feb 8, 2024
58 checks passed
@dani-garcia dani-garcia deleted the ps/bitwarden-json-lock branch February 8, 2024 09:54
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.

3 participants