policies: don't fork for group and user bindings
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
@ -108,6 +108,9 @@ class PolicyEngine:
|
|||||||
self.__cached_policies.append(cached_policy)
|
self.__cached_policies.append(cached_policy)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def _should_fork(self, binding: PolicyBinding) -> bool:
|
||||||
|
return binding.policy is not None
|
||||||
|
|
||||||
def build(self) -> "PolicyEngine":
|
def build(self) -> "PolicyEngine":
|
||||||
"""Build wrapper which monitors performance"""
|
"""Build wrapper which monitors performance"""
|
||||||
with (
|
with (
|
||||||
@ -134,7 +137,7 @@ class PolicyEngine:
|
|||||||
task = PolicyProcess(binding, self.request, task_end)
|
task = PolicyProcess(binding, self.request, task_end)
|
||||||
task.daemon = False
|
task.daemon = False
|
||||||
self.logger.debug("P_ENG: Starting Process", binding=binding, request=self.request)
|
self.logger.debug("P_ENG: Starting Process", binding=binding, request=self.request)
|
||||||
if not CURRENT_PROCESS._config.get("daemon"):
|
if not CURRENT_PROCESS._config.get("daemon") or not self._should_fork(binding):
|
||||||
task.run()
|
task.run()
|
||||||
else:
|
else:
|
||||||
task.start()
|
task.start()
|
||||||
|
Reference in New Issue
Block a user