Skip to content

Commit cb057a4

Browse files
authored
chore: add timeout to create project (#47)
Make sure we exit from the project status check --------- Signed-off-by: Ivan Pedrazas <ipedrazas@gmail.com>
1 parent 94082f9 commit cb057a4

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "neptune-mcp"
3-
version = "0.1.32"
3+
version = "0.1.1"
44
description = "MCP server for Neptune (neptune.dev)"
55
readme = "README.md"
66
requires-python = ">=3.13"

src/neptune_mcp/mcp.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,22 @@ def provision_resources(neptune_json_path: str) -> dict[str, Any]:
218218

219219
# while loop to retrieve project status, wait until ready
220220
project = client.get_project(project_request.name)
221+
project_start_time = time.time()
222+
project_timeout = 90 # 90 seconds
221223

222224
while project is None or project.provisioning_state != "Ready":
225+
if time.time() - project_start_time > project_timeout:
226+
log.error(f"Project provisioning timed out after {project_timeout} seconds")
227+
return {
228+
"status": "error",
229+
"message": f"project provisioning timed out after {project_timeout} seconds while waiting for status 'Ready'",
230+
"next_step": "wait a moment and retry provisioning with 'provision_resources', or check the project status and investigate any provisioning issues",
231+
}
223232
if project is not None:
224233
log.info(
225234
f"Project '{project_request.name}' status: {project.provisioning_state}. Waiting for resources to be provisioned..."
226235
)
227-
time.sleep(2)
236+
time.sleep(5)
228237
project = client.get_project(project_request.name)
229238

230239
# go over all resources, wait until all are provisioned

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)