7777)
7878from ..hardware .data import Device
7979from ..homeassistant .const import WSEvent
80- from ..jobs .const import JobExecutionLimit
80+ from ..jobs .const import JobConcurrency , JobThrottle
8181from ..jobs .decorator import Job
8282from ..resolution .const import ContextType , IssueType , UnhealthyReason
8383from ..resolution .data import Issue
@@ -733,8 +733,8 @@ async def write_options(self) -> None:
733733
734734 @Job (
735735 name = "addon_unload" ,
736- limit = JobExecutionLimit .GROUP_ONCE ,
737736 on_condition = AddonsJobError ,
737+ concurrency = JobConcurrency .GROUP_REJECT ,
738738 )
739739 async def unload (self ) -> None :
740740 """Unload add-on and remove data."""
@@ -766,8 +766,8 @@ async def _check_ingress_port(self):
766766
767767 @Job (
768768 name = "addon_install" ,
769- limit = JobExecutionLimit .GROUP_ONCE ,
770769 on_condition = AddonsJobError ,
770+ concurrency = JobConcurrency .GROUP_REJECT ,
771771 )
772772 async def install (self ) -> None :
773773 """Install and setup this addon."""
@@ -807,8 +807,8 @@ def setup_data():
807807
808808 @Job (
809809 name = "addon_uninstall" ,
810- limit = JobExecutionLimit .GROUP_ONCE ,
811810 on_condition = AddonsJobError ,
811+ concurrency = JobConcurrency .GROUP_REJECT ,
812812 )
813813 async def uninstall (
814814 self , * , remove_config : bool , remove_image : bool = True
@@ -873,8 +873,8 @@ def cleanup_config_and_audio():
873873
874874 @Job (
875875 name = "addon_update" ,
876- limit = JobExecutionLimit .GROUP_ONCE ,
877876 on_condition = AddonsJobError ,
877+ concurrency = JobConcurrency .GROUP_REJECT ,
878878 )
879879 async def update (self ) -> asyncio .Task | None :
880880 """Update this addon to latest version.
@@ -923,8 +923,8 @@ async def update(self) -> asyncio.Task | None:
923923
924924 @Job (
925925 name = "addon_rebuild" ,
926- limit = JobExecutionLimit .GROUP_ONCE ,
927926 on_condition = AddonsJobError ,
927+ concurrency = JobConcurrency .GROUP_REJECT ,
928928 )
929929 async def rebuild (self ) -> asyncio .Task | None :
930930 """Rebuild this addons container and image.
@@ -1068,8 +1068,8 @@ async def _wait_for_startup(self) -> None:
10681068
10691069 @Job (
10701070 name = "addon_start" ,
1071- limit = JobExecutionLimit .GROUP_ONCE ,
10721071 on_condition = AddonsJobError ,
1072+ concurrency = JobConcurrency .GROUP_REJECT ,
10731073 )
10741074 async def start (self ) -> asyncio .Task :
10751075 """Set options and start add-on.
@@ -1117,8 +1117,8 @@ def _check_addon_config_dir():
11171117
11181118 @Job (
11191119 name = "addon_stop" ,
1120- limit = JobExecutionLimit .GROUP_ONCE ,
11211120 on_condition = AddonsJobError ,
1121+ concurrency = JobConcurrency .GROUP_REJECT ,
11221122 )
11231123 async def stop (self ) -> None :
11241124 """Stop add-on."""
@@ -1131,8 +1131,8 @@ async def stop(self) -> None:
11311131
11321132 @Job (
11331133 name = "addon_restart" ,
1134- limit = JobExecutionLimit .GROUP_ONCE ,
11351134 on_condition = AddonsJobError ,
1135+ concurrency = JobConcurrency .GROUP_REJECT ,
11361136 )
11371137 async def restart (self ) -> asyncio .Task :
11381138 """Restart add-on.
@@ -1166,8 +1166,8 @@ async def stats(self) -> DockerStats:
11661166
11671167 @Job (
11681168 name = "addon_write_stdin" ,
1169- limit = JobExecutionLimit .GROUP_ONCE ,
11701169 on_condition = AddonsJobError ,
1170+ concurrency = JobConcurrency .GROUP_REJECT ,
11711171 )
11721172 async def write_stdin (self , data ) -> None :
11731173 """Write data to add-on stdin."""
@@ -1200,8 +1200,8 @@ async def _backup_command(self, command: str) -> None:
12001200
12011201 @Job (
12021202 name = "addon_begin_backup" ,
1203- limit = JobExecutionLimit .GROUP_ONCE ,
12041203 on_condition = AddonsJobError ,
1204+ concurrency = JobConcurrency .GROUP_REJECT ,
12051205 )
12061206 async def begin_backup (self ) -> bool :
12071207 """Execute pre commands or stop addon if necessary.
@@ -1222,8 +1222,8 @@ async def begin_backup(self) -> bool:
12221222
12231223 @Job (
12241224 name = "addon_end_backup" ,
1225- limit = JobExecutionLimit .GROUP_ONCE ,
12261225 on_condition = AddonsJobError ,
1226+ concurrency = JobConcurrency .GROUP_REJECT ,
12271227 )
12281228 async def end_backup (self ) -> asyncio .Task | None :
12291229 """Execute post commands or restart addon if necessary.
@@ -1260,8 +1260,8 @@ def _is_excluded_by_filter(
12601260
12611261 @Job (
12621262 name = "addon_backup" ,
1263- limit = JobExecutionLimit .GROUP_ONCE ,
12641263 on_condition = AddonsJobError ,
1264+ concurrency = JobConcurrency .GROUP_REJECT ,
12651265 )
12661266 async def backup (self , tar_file : tarfile .TarFile ) -> asyncio .Task | None :
12671267 """Backup state of an add-on.
@@ -1368,8 +1368,8 @@ def _addon_backup(
13681368
13691369 @Job (
13701370 name = "addon_restore" ,
1371- limit = JobExecutionLimit .GROUP_ONCE ,
13721371 on_condition = AddonsJobError ,
1372+ concurrency = JobConcurrency .GROUP_REJECT ,
13731373 )
13741374 async def restore (self , tar_file : tarfile .TarFile ) -> asyncio .Task | None :
13751375 """Restore state of an add-on.
@@ -1521,10 +1521,10 @@ def check_trust(self) -> Awaitable[None]:
15211521
15221522 @Job (
15231523 name = "addon_restart_after_problem" ,
1524- limit = JobExecutionLimit .GROUP_THROTTLE_RATE_LIMIT ,
15251524 throttle_period = WATCHDOG_THROTTLE_PERIOD ,
15261525 throttle_max_calls = WATCHDOG_THROTTLE_MAX_CALLS ,
15271526 on_condition = AddonsJobError ,
1527+ throttle = JobThrottle .GROUP_RATE_LIMIT ,
15281528 )
15291529 async def _restart_after_problem (self , state : ContainerState ):
15301530 """Restart unhealthy or failed addon."""
0 commit comments