Skip to content

Commit

Permalink
add maximum number of clients
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsmechtel committed Oct 18, 2024
1 parent 959abde commit de959a3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bioimageio_colab/register_sam_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ async def register_service(args: dict) -> None:

# Initialize caches
model_cache = TTLCache(maxsize=len(MODELS), ttl=args.model_timeout)
embedding_cache = TTLCache(maxsize=np.inf, ttl=args.embedding_timeout)
embedding_cache = TTLCache(maxsize=args.max_num_clients, ttl=args.embedding_timeout)

# Register a new service
service_info = await colab_client.register_service(
Expand Down Expand Up @@ -318,6 +318,12 @@ async def register_service(args: dict) -> None:
default=600, # 10 minutes
help="Embedding cache timeout in seconds",
)
parser.add_argument(
"--max_num_clients",
type=int,
default=50,
help="Maximum number of clients to cache embeddings for",
)
args = parser.parse_args()

loop = asyncio.get_event_loop()
Expand Down

0 comments on commit de959a3

Please sign in to comment.