Revert unnecessary improving in ContextAccessCache for now.

This commit is contained in:
Vitaly Baranov 2023-07-17 14:52:17 +02:00
parent 815a3857de
commit 2379d8c9d5

View File

@ -71,7 +71,6 @@ public:
explicit ContextAccessCache(const AccessControl & access_control_) : access_control(access_control_) {}
std::shared_ptr<const ContextAccess> getContextAccess(const ContextAccessParams & params)
{
{
std::lock_guard lock{mutex};
auto x = cache.get(params);
@ -82,16 +81,11 @@ public:
else
return *x;
}
}
/// TODO: There is no need to keep the `ContextAccessCache::mutex` locked while we're calculating access rights.
auto res = std::make_shared<ContextAccess>(access_control, params);
res->initialize();
{
std::lock_guard lock{mutex};
cache.add(params, res);
}
return res;
}