Skip to content

Commit 081de17

Browse files
Heinrich Kruppclaude
authored andcommitted
fix: resolve syntax errors in strict timeout cap from PR #569
- Remove duplicate detect_mcp_client_simple() call - Remove orphaned closing paren and duplicate return statement - Extract magic values into named constants (ADAPTIVE_TIMEOUT_CLIENT, STRICT_CLIENT_TIMEOUT_CAP_S) - Fix dead else-path: guard with strict_timeout < timeout - Clarify warning messages with "(before client cap)" suffix - Add trailing newline (PEP 8) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 77cf360 commit 081de17

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/mcp_memory_service/dependency_check.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -249,28 +249,28 @@ def get_recommended_timeout() -> float:
249249
# Extend timeout if dependencies are missing
250250
if not all_installed:
251251
timeout *= 2 # Double the timeout
252-
logger.warning(f"Dependencies missing, extending timeout to {timeout}s")
252+
logger.warning(f"Dependencies missing, extending base timeout to {timeout}s (before client cap)")
253253

254254
# Extend timeout if it's first run
255255
if first_run:
256256
timeout *= 2 # Double the timeout
257-
logger.warning(f"First run detected, extending timeout to {timeout}s")
257+
logger.warning(f"First run detected, extending base timeout to {timeout}s (before client cap)")
258258

259259
# Strict stdio clients often have small handshake budgets.
260260
# Keep eager init conservative and rely on lazy-load fallback.
261-
client = detect_mcp_client_simple()
262261
ADAPTIVE_TIMEOUT_CLIENT = 'lm_studio'
262+
STRICT_CLIENT_TIMEOUT_CAP_S = 5.0
263+
263264
client = detect_mcp_client_simple()
264-
if client != 'lm_studio':
265-
strict_timeout = min(timeout, 5.0)
266-
logger.info(
267-
"Strict MCP client detected (%s); capping eager init timeout from %.1fs to %.1fs",
268-
client,
269-
timeout,
270-
strict_timeout,
271-
)
272-
timeout = strict_timeout
265+
if client != ADAPTIVE_TIMEOUT_CLIENT:
266+
strict_timeout = min(timeout, STRICT_CLIENT_TIMEOUT_CAP_S)
267+
if strict_timeout < timeout:
268+
logger.info(
269+
"Strict MCP client detected (%s); capping eager init timeout from %.1fs to %.1fs",
270+
client,
271+
timeout,
272+
strict_timeout,
273273
)
274-
return timeout
274+
timeout = strict_timeout
275275

276-
return timeout
276+
return timeout

0 commit comments

Comments
 (0)