policies: log correct cache state
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
b6b72e389d
commit
9ffc720f48
|
@ -42,7 +42,7 @@ class BaseEvaluator:
|
|||
"ak_user_by": BaseEvaluator.expr_user_by,
|
||||
"ak_user_has_authenticator": BaseEvaluator.expr_func_user_has_authenticator,
|
||||
"ak_create_event": self.expr_event_create,
|
||||
"ak_logger": get_logger(self._filename),
|
||||
"ak_logger": get_logger(self._filename).bind(),
|
||||
"requests": get_http_session(),
|
||||
"ip_address": ip_address,
|
||||
"ip_network": ip_network,
|
||||
|
|
|
@ -101,12 +101,14 @@ class PolicyProcess(PROCESS_CLASS):
|
|||
LOGGER.debug("P_ENG(proc): error", exc=src_exc)
|
||||
policy_result = PolicyResult(False, str(src_exc))
|
||||
policy_result.source_binding = self.binding
|
||||
if self.request.should_cache:
|
||||
should_cache = self.request.should_cache
|
||||
if should_cache:
|
||||
key = cache_key(self.binding, self.request)
|
||||
cache.set(key, policy_result, CACHE_TIMEOUT)
|
||||
LOGGER.debug(
|
||||
"P_ENG(proc): finished and cached ",
|
||||
"P_ENG(proc): finished",
|
||||
policy=self.binding.policy,
|
||||
cached=should_cache,
|
||||
result=policy_result,
|
||||
# this is used for filtering in access checking where logs are sent to the admin
|
||||
process="PolicyProcess",
|
||||
|
|
Reference in New Issue