chore(acl): add vlog and check on deluser flow (#2995)

* add vlog before and after we evict connections on deluser flow
* replace dcheck with check
This commit is contained in:
Kostas Kyrimis 2024-05-01 21:22:44 +03:00 committed by GitHub
parent 07d076a658
commit f20512e8b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -126,7 +126,7 @@ void AclFamily::SetUser(CmdArgList args, ConnectionContext* cntx) {
void AclFamily::EvictOpenConnectionsOnAllProactors(
const absl::flat_hash_set<std::string_view>& users) {
auto close_cb = [&users]([[maybe_unused]] size_t id, util::Connection* conn) {
DCHECK(conn);
CHECK(conn);
auto connection = static_cast<facade::Connection*>(conn);
auto ctx = static_cast<ConnectionContext*>(connection->cntx());
if (ctx && users.contains(ctx->authed_username)) {
@ -142,7 +142,7 @@ void AclFamily::EvictOpenConnectionsOnAllProactors(
void AclFamily::EvictOpenConnectionsOnAllProactorsWithRegistry(
const UserRegistry::RegistryType& registry) {
auto close_cb = [&registry]([[maybe_unused]] size_t id, util::Connection* conn) {
DCHECK(conn);
CHECK(conn);
auto connection = static_cast<facade::Connection*>(conn);
auto ctx = static_cast<ConnectionContext*>(connection->cntx());
if (ctx && ctx->authed_username != "default" && registry.contains(ctx->authed_username)) {
@ -173,8 +173,9 @@ void AclFamily::DelUser(CmdArgList args, ConnectionContext* cntx) {
cntx->SendLong(0);
return;
}
VLOG(1) << "Evicting open acl connections";
EvictOpenConnectionsOnAllProactors(users);
VLOG(1) << "Done evicting open acl connections";
cntx->SendLong(users.size());
}