diff --git a/src/service/allocation.py b/src/service/allocation.py index 07cd4c6..7d572a2 100644 --- a/src/service/allocation.py +++ b/src/service/allocation.py @@ -62,7 +62,6 @@ async def create(self, allocation: proto.CreateAllocation) -> domain.Allocation: | proto.CreateRoomedAllocation | proto.CreateClosedAllocation, ): - if not await common.check_participants_exist( allocation, self._participant_repo ): diff --git a/src/utils/logger/logger.py b/src/utils/logger/logger.py index a7e39f1..f3ad4ae 100644 --- a/src/utils/logger/logger.py +++ b/src/utils/logger/logger.py @@ -22,7 +22,7 @@ def __init__(self, context: str): raw=False, capture=True, patchers=[], - extra={"context": context, "correlation_id": None}, + extra={"context": context, "correlation_id": ""}, ) logger_format = ( "{time:YYYY-MM-DD HH:mm:ss.SSS}|" @@ -49,25 +49,37 @@ def _finish_record(self, name: str) -> str: @property def cor_id(self) -> str | None: cor_id = COR_ID.get() - return cor_id.hex if cor_id else None + return cor_id.hex if cor_id is not None else "" def trace(self, message, *args, **kwargs): - super().trace(message, *args, correlation_id=self.cor_id, **kwargs) + if self.cor_id: + kwargs["correlation_id"] = self.cor_id + super().trace(message, *args, **kwargs) def debug(self, message, *args, **kwargs): - super().debug(message, *args, correlation_id=self.cor_id, **kwargs) + if self.cor_id: + kwargs["correlation_id"] = self.cor_id + super().debug(message, *args, **kwargs) def info(self, message, *args, **kwargs): - super().info(message, *args, correlation_id=self.cor_id, **kwargs) + if self.cor_id: + kwargs["correlation_id"] = self.cor_id + super().info(message, *args, **kwargs) def warning(self, message, *args, **kwargs): - super().warning(message, *args, correlation_id=self.cor_id, **kwargs) + if self.cor_id: + kwargs["correlation_id"] = self.cor_id + super().warning(message, *args, **kwargs) def error(self, message, *args, **kwargs): - super().error(message, *args, correlation_id=self.cor_id, **kwargs) + if self.cor_id: + kwargs["correlation_id"] = self.cor_id + super().error(message, *args, **kwargs) def critical(self, message, *args, **kwargs): - super().critical(message, *args, correlation_id=self.cor_id, **kwargs) + if self.cor_id: + kwargs["correlation_id"] = self.cor_id + super().critical(message, *args, **kwargs) @contextmanager def activity(self, name: str, with_traceback: bool = False, capture: bool = False):