@@ -210,9 +210,11 @@ def _get_source(self, metadata: dict[str, Any], name: str) -> dict[str, Any] | N
210210 else :
211211 return None
212212
213- async def _hasura_request (self , endpoint : str , json : dict [str , Any ] | None = None ) -> dict [str , Any ]:
213+ async def _hasura_request (self , endpoint : str , json : dict [str , Any ] | None = None , retry_count : int | None = None ) -> dict [str , Any ]:
214214 self ._logger .debug ('Sending `%s` request: %s' , endpoint , orjson .dumps (json ))
215215 try :
216+ if retry_count is not None :
217+ self ._http_config .retry_count , retry_count = retry_count , self ._http_config .retry_count
216218 result = await self .request (
217219 method = 'get' if json is None else 'post' ,
218220 url = f'v1/{ endpoint } ' ,
@@ -221,6 +223,9 @@ async def _hasura_request(self, endpoint: str, json: dict[str, Any] | None = Non
221223 )
222224 except ClientResponseError as e :
223225 raise HasuraError (f'{ e .status } { e .message } ' ) from e
226+ finally :
227+ if retry_count is not None :
228+ self ._http_config .retry_count , retry_count = retry_count , self ._http_config .retry_count
224229
225230 self ._logger .debug ('Response: %s' , result )
226231 if errors := result .get ('error' ) or result .get ('errors' ):
@@ -230,7 +235,7 @@ async def _hasura_request(self, endpoint: str, json: dict[str, Any] | None = Non
230235
231236 async def _healthcheck (self ) -> None :
232237 self ._logger .info ('Connecting to Hasura instance' )
233- version_json = await self ._hasura_request ('version' )
238+ version_json = await self ._hasura_request ('version' , retry_count = 20 )
234239 version = version_json ['version' ]
235240 if version .startswith ('v1' ):
236241 raise UnsupportedAPIError (
0 commit comments