SensitiveDataMasker: reduce the scope of mutex

This commit is contained in:
Mikhail Koviazin 2023-11-15 17:45:28 +02:00
parent dfdd1a761e
commit 604b10238b
No known key found for this signature in database
GPG Key ID: 0EEAA1BF0787792F

View File

@ -99,11 +99,11 @@ std::mutex SensitiveDataMasker::instance_mutex;
void SensitiveDataMasker::setInstance(std::unique_ptr<SensitiveDataMasker> sensitive_data_masker_)
{
std::lock_guard lock(instance_mutex);
if (!sensitive_data_masker_)
throw Exception(ErrorCodes::LOGICAL_ERROR, "Logical error: the 'sensitive_data_masker' is not set");
std::lock_guard lock(instance_mutex);
if (sensitive_data_masker_->rulesCount() > 0)
{
sensitive_data_masker = std::move(sensitive_data_masker_);