mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 02:15:45 +02:00
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:
parent
07d076a658
commit
f20512e8b1
1 changed files with 4 additions and 3 deletions
|
@ -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 = [®istry]([[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());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue