mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Pre-set the HassJob job_type cached_property if its known (#118199)
This commit is contained in:
parent
811ec57c31
commit
56431ef750
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user