File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change 44from prefect import flow
55from prefect .client .orchestration import get_client
66
7+ from infrahub import lock
78from infrahub .context import InfrahubContext # noqa: TC001 needed for prefect flow
89from infrahub .services import InfrahubServices # noqa: TC001 needed for prefect flow
910from infrahub .trigger .models import TriggerType
@@ -100,14 +101,14 @@ async def run_generator_group_event(
100101async def configure_action_rules (
101102 service : InfrahubServices ,
102103) -> None :
103- triggers = await gather_trigger_action_rules ( db = service . database )
104-
105- async with get_client (sync_client = False ) as prefect_client :
106- await setup_triggers (
107- client = prefect_client ,
108- triggers = triggers ,
109- trigger_type = TriggerType .ACTION_TRIGGER_RULE ,
110- ) # type: ignore[misc]
104+ async with lock . registry . get ( name = "configure-action-rules" , namespace = "trigger-rules" , local = False ):
105+ triggers = await gather_trigger_action_rules ( db = service . database )
106+ async with get_client (sync_client = False ) as prefect_client :
107+ await setup_triggers (
108+ client = prefect_client ,
109+ triggers = triggers ,
110+ trigger_type = TriggerType .ACTION_TRIGGER_RULE ,
111+ ) # type: ignore[misc]
111112
112113
113114async def _run_generator (
You can’t perform that action at this time.
0 commit comments