Improve logging when the auto-disable mechanism is ignoring accounts Before this change, accounts auto-disable mechanism was silently ignored and account entries removed from cache. Include an explicit logging tracing the account-id that is ignored and do not remove it from cache anymore. Change-Id: I19e75dad3d74ebf161c472a85894fa1ccadecbc4
diff --git a/admin/track-and-disable-inactive-users-1.3.groovy b/admin/track-and-disable-inactive-users-1.3.groovy index 0cc0cb3..edc0f0c 100644 --- a/admin/track-and-disable-inactive-users-1.3.groovy +++ b/admin/track-and-disable-inactive-users-1.3.groovy
@@ -197,8 +197,15 @@ return } + def accountId = Account.id(notification.key) + if (notification.cause == RemovalCause.EXPIRED) { - disableAccount(Account.id(notification.key)) + if (autoDisableConfig.ignoreAccountIds.contains(accountId)) { + logger.atWarning().log("Account %s ignored from the auto-disable mechanism", accountId) + trackActiveUsersCache.put(notification.key, notification.value) + } else { + disableAccount(accountId) + } } else if (notification.cause == RemovalCause.EXPLICIT) { logger.atWarning().log( "cache %s do not support eviction, entry for user %d will be added back", fullCacheName, notification.key) @@ -207,10 +214,6 @@ } private void disableAccount(Account.Id accountId) { - if (autoDisableConfig.ignoreAccountIds.contains(accountId)) { - return - } - logger.atInfo().log("Automatically disabling user id: %d", accountId.get()) accountsUpdate.get().update( """Automatically disabling after inactivity