diff --git a/homeassistant/core.py b/homeassistant/core.py index 9c5d8612b27..573ddde05ba 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -330,12 +330,15 @@ class HassJob[**_P, _R_co]: self.target: Final = target self.name = name self._cancel_on_shutdown = cancel_on_shutdown - self._job_type = job_type + if job_type: + # Pre-set the cached_property so we + # avoid the function call + self.__dict__["job_type"] = job_type @cached_property def job_type(self) -> HassJobType: """Return the job type.""" - return self._job_type or get_hassjob_callable_job_type(self.target) + return get_hassjob_callable_job_type(self.target) @property def cancel_on_shutdown(self) -> bool | None: