Skip to content

Commit

Permalink
minor-perf: move secret provider string (#38350)
Browse files Browse the repository at this point in the history
Commit Message: minor-perf: move secret provider string
Additional Description:
Minor perf-nit: moving a secret provider string instead of copying it

Risk Level: low
Testing: N/A
Docs Changes: N/A
Release Notes: N/A
Platform Specific Features: N/A

Signed-off-by: Adi Suissa-Peleg <[email protected]>
  • Loading branch information
adisuissa authored Feb 10, 2025
1 parent 3a1e31a commit a872d38
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/common/secret/secret_provider_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ ThreadLocalGenericSecretProvider::ThreadLocalGenericSecretProvider(
if (const auto* secret = provider_->secret(); secret != nullptr) {
auto value_or_error = Config::DataSource::read(secret->secret(), true, api_);
SET_AND_RETURN_IF_NOT_OK(value_or_error.status(), creation_status);
value = *value_or_error;
value = std::move(value_or_error.value());
}
tls_->set([value = std::move(value)](Event::Dispatcher&) {
return std::make_shared<ThreadLocalSecret>(value);
Expand All @@ -71,7 +71,7 @@ absl::Status ThreadLocalGenericSecretProvider::update() {
if (const auto* secret = provider_->secret(); secret != nullptr) {
auto value_or_error = Config::DataSource::read(secret->secret(), true, api_);
RETURN_IF_NOT_OK_REF(value_or_error.status());
value = *value_or_error;
value = std::move(value_or_error.value());
}
tls_->runOnAllThreads(
[value = std::move(value)](OptRef<ThreadLocalSecret> tls) { tls->value_ = value; });
Expand Down

0 comments on commit a872d38

Please sign in to comment.