55from collections .abc import Mapping
66from http import HTTPStatus
77from pprint import pformat
8- from typing import Any , Final , cast
8+ from typing import Any , cast
99
1010from aiocache import Cache , SimpleMemoryCache # type: ignore[import-untyped]
1111from aiohttp import BasicAuth , ClientSession , client_exceptions
3333
3434DEPENDENCIES_LABEL_KEY : str = "simcore.service.dependencies"
3535
36- NUMBER_OF_RETRIEVED_REPOS : int = 50
37- NUMBER_OF_RETRIEVED_TAGS : int = 50
38- _MAX_CONCURRENT_CALLS : Final [int ] = 50
3936VERSION_REG = re .compile (
4037 r"^(0|[1-9]\d*)(\.(0|[1-9]\d*)){2}(-(0|[1-9]\d*|\d*[-a-zA-Z][-\da-zA-Z]*)(\.(0|[1-9]\d*|\d*[-a-zA-Z][-\da-zA-Z]*))*)?(\+[-\da-zA-Z]+(\.[-\da-zA-Z-]+)*)?$"
4138)
@@ -277,7 +274,7 @@ async def on_shutdown() -> None:
277274async def _list_repositories (app : FastAPI ) -> list [str ]:
278275 logger .debug ("listing repositories" )
279276 # if there are more repos, the Link will be available in the response headers until none available
280- path = f"/v2/_catalog?n={ NUMBER_OF_RETRIEVED_REPOS } "
277+ path = f"/v2/_catalog?n={ get_application_settings ( app ). DIRECTOR_REGISTRY_CLIENT_MAX_NUMBER_OF_RETRIEVED_OBJECTS } "
281278 repos_list : list = []
282279 while True :
283280 result , headers = await registry_request (app , path )
@@ -294,7 +291,7 @@ async def list_image_tags(app: FastAPI, image_key: str) -> list[str]:
294291 logger .debug ("listing image tags in %s" , image_key )
295292 image_tags : list = []
296293 # get list of image tags
297- path = f"/v2/{ image_key } /tags/list?n={ NUMBER_OF_RETRIEVED_TAGS } "
294+ path = f"/v2/{ image_key } /tags/list?n={ get_application_settings ( app ). DIRECTOR_REGISTRY_CLIENT_MAX_NUMBER_OF_RETRIEVED_OBJECTS } "
298295 while True :
299296 tags , headers = await registry_request (app , path )
300297 if tags ["tags" ]:
@@ -385,7 +382,9 @@ async def get_repo_details(app: FastAPI, image_key: str) -> list[dict[str, Any]]
385382 * [get_image_details (app , image_key , tag ) for tag in image_tags ],
386383 reraise = False ,
387384 log = logger ,
388- limit = _MAX_CONCURRENT_CALLS ,
385+ limit = get_application_settings (
386+ app
387+ ).DIRECTOR_REGISTRY_CLIENT_MAX_CONCURRENT_CALLS ,
389388 )
390389 return [result for result in results if not isinstance (result , BaseException )]
391390
@@ -407,7 +406,9 @@ async def list_services(app: FastAPI, service_type: ServiceType) -> list[dict]:
407406 * [get_repo_details (app , repo ) for repo in repos ],
408407 reraise = False ,
409408 log = logger ,
410- limit = _MAX_CONCURRENT_CALLS ,
409+ limit = get_application_settings (
410+ app
411+ ).DIRECTOR_REGISTRY_CLIENT_MAX_CONCURRENT_CALLS ,
411412 )
412413
413414 return [
0 commit comments