@@ -637,8 +637,7 @@ async def wait_until_converged(self, branch: Optional[str] = None) -> None:
637637        """Wait until the schema has converged on the selected branch or the timeout has been reached""" 
638638        waited  =  0 
639639        while  True :
640-             status  =  await  self .client .execute_graphql (query = SCHEMA_HASH_SYNC_STATUS , branch_name = branch )
641-             if  status ["InfrahubStatus" ]["summary" ]["schema_hash_synced" ]:
640+             if  await  self .in_sync (branch = branch ):
642641                self .client .log .info (f"Schema successfully converged after { waited }   seconds" )
643642                return 
644643
@@ -649,6 +648,11 @@ async def wait_until_converged(self, branch: Optional[str] = None) -> None:
649648            waited  +=  1 
650649            await  asyncio .sleep (delay = 1 )
651650
651+     async  def  in_sync (self , branch : Optional [str ] =  None ) ->  bool :
652+         """Indicate if the schema is in sync across all workers for the provided branch""" 
653+         response  =  await  self .client .execute_graphql (query = SCHEMA_HASH_SYNC_STATUS , branch_name = branch )
654+         return  response ["InfrahubStatus" ]["summary" ]["schema_hash_synced" ]
655+ 
652656    async  def  check (self , schemas : list [dict ], branch : Optional [str ] =  None ) ->  tuple [bool , Optional [dict ]]:
653657        branch  =  branch  or  self .client .default_branch 
654658        url  =  f"{ self .client .address }  /api/schema/check?branch={ branch }  " 
@@ -1041,8 +1045,7 @@ def wait_until_converged(self, branch: Optional[str] = None) -> None:
10411045        """Wait until the schema has converged on the selected branch or the timeout has been reached""" 
10421046        waited  =  0 
10431047        while  True :
1044-             status  =  self .client .execute_graphql (query = SCHEMA_HASH_SYNC_STATUS , branch_name = branch )
1045-             if  status ["InfrahubStatus" ]["summary" ]["schema_hash_synced" ]:
1048+             if  self .in_sync (branch = branch ):
10461049                self .client .log .info (f"Schema successfully converged after { waited }   seconds" )
10471050                return 
10481051
@@ -1053,6 +1056,11 @@ def wait_until_converged(self, branch: Optional[str] = None) -> None:
10531056            waited  +=  1 
10541057            sleep (1 )
10551058
1059+     def  in_sync (self , branch : Optional [str ] =  None ) ->  bool :
1060+         """Indicate if the schema is in sync across all workers for the provided branch""" 
1061+         response  =  self .client .execute_graphql (query = SCHEMA_HASH_SYNC_STATUS , branch_name = branch )
1062+         return  response ["InfrahubStatus" ]["summary" ]["schema_hash_synced" ]
1063+ 
10561064    def  check (self , schemas : list [dict ], branch : Optional [str ] =  None ) ->  tuple [bool , Optional [dict ]]:
10571065        branch  =  branch  or  self .client .default_branch 
10581066        url  =  f"{ self .client .address }  /api/schema/check?branch={ branch }  " 
0 commit comments