DatabaseClient is essentially an instance factory, we
don't need to be taking ownership of it on every function call;
thus forcing a .clone() on the caller.
Details
Details
This will be tested more thoroughly in a later diff, however,
the changes should just reduce the number of deep copies we do
of the "instance factory".
cd services/identity cargo build
Diff Detail
Diff Detail
- Repository
- rCOMM Comm
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
DatabaseClient essentially just wraps the AWS DynamoDB client in an Arc. I'm not sure why we need to avoid cloning
Comment Actions
We don't need 15 difference copies of the Arc wrapping; just when we cross a thread boundary like tokio::spawn.
I'm not sure why we need to avoid cloning
For similar reasons to preferring &str over String::clone(), because you don't need to copy.
Comment Actions
i think cloning here is pretty inexpensive since we're just incrementing the atomic reference count, but you're right, we should avoid it altogether when possible