Skip to content

Commit 96407c6

Browse files
committed
fix warning
1 parent 6cc6c3a commit 96407c6

File tree

1 file changed

+3
-10
lines changed
  • services/director-v2/src/simcore_service_director_v2/api/dependencies

1 file changed

+3
-10
lines changed

services/director-v2/src/simcore_service_director_v2/api/dependencies/database.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,11 @@ def get_base_repository(engine: AsyncEngine, repo_type: type[RepoType]) -> RepoT
2626
# now the current solution is to acquire connection when needed.
2727

2828
# Get pool metrics
29-
checkedin = engine.pool.checkedin() # type: ignore # connections available in pool
30-
checkedout = engine.pool.checkedout() # type: ignore # connections in use
29+
in_use = engine.pool.checkedout() # type: ignore # connections in use
3130
total_size = engine.pool.size() # type: ignore # current total connections
3231

33-
if (checkedin < 2) and (total_size > 1): # noqa: PLR2004
34-
logger.warning(
35-
"Database connection pool near limits: total=%d, in_use=%d, available=%d, overflow=%d",
36-
total_size,
37-
checkedout,
38-
checkedin,
39-
max(checkedout - total_size, 0),
40-
)
32+
if (total_size > 1) and (in_use > (total_size - 2)):
33+
logger.warning("Database connection pool near limits: %s", engine.pool.status())
4134

4235
return repo_type(db_engine=engine)
4336

0 commit comments

Comments
 (0)