mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 22:11:14 +02:00
fix: remove background init timeout and allow skills reload retry
- Remove 5s thread.join() timeout so git clone/pull is not truncated - Remove _init_complete flag, reset _init_in_progress on failure instead - Let /reload/skills API retry initialization after network failure - Raise GIT_HTTP_LOW_SPEED_LIMIT from 1 KB/s to 10 KB/s Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
1 parent
27051a89ad
commit
ae1a444677
3 files changed
+17
-26
No files matched your search
@@ -37,26 +37,13 @@ try:
|
||||
from .gns3_copilot.project_agent_manager import ProjectAgentManager
|
||||
AI_COPILOT_AVAILABLE = True
|
||||
|
||||
# Start skills repository initialization in background with 5s timeout.
|
||||
# This clones/pulls GNS3-Skills during server startup.
|
||||
# If GitHub is unreachable (common in some regions), the timeout
|
||||
# ensures the server starts without delay, using fallback defaults.
|
||||
def _init_skills_background():
|
||||
"""Initialize skills repo - called from background thread."""
|
||||
from gns3server.agent.gns3_copilot.skills.registry import _ensure_skills_manager
|
||||
# Start skills repository initialization in background.
|
||||
# Clones/pulls GNS3-Skills during server startup.
|
||||
# Git network timeouts are configured in SkillsManager (_GIT_TIMEOUT_ENV).
|
||||
# The daemon thread auto-terminates when the process exits.
|
||||
from gns3server.agent.gns3_copilot.skills.registry import _ensure_skills_manager
|
||||
|
||||
t = threading.Thread(target=_ensure_skills_manager, daemon=True)
|
||||
t.start()
|
||||
t.join(5)
|
||||
if t.is_alive():
|
||||
log = logging.getLogger(__name__)
|
||||
log.warning(
|
||||
"Skills repository initialization timed out (5s). "
|
||||
"Will use fallback defaults. "
|
||||
"The background thread will complete when network is available."
|
||||
)
|
||||
|
||||
threading.Thread(target=_init_skills_background, daemon=True).start()
|
||||
threading.Thread(target=_ensure_skills_manager, daemon=True).start()
|
||||
|
||||
except ImportError as e:
|
||||
# AI dependencies not installed, disable AI Copilot feature
|
||||
|
||||
Reference in new issue
Block a user