Fix race condition (#676)

Server start events were sometimes not being tracked because of a race
condition. Adding 150ms wait for now. Longer term solution:
https://app.clickup.com/t/86b7bm6kp

Other events do not suffer from this issue
This commit is contained in:
Eric Gustin 2025-11-04 15:40:47 -08:00 committed by GitHub
parent a770edca4a
commit 139cc2e54d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -110,6 +110,13 @@ class ServerTracker:
self.usage_service.capture(
EVENT_MCP_SERVER_STARTED, self.user_id, properties=properties, is_anon=is_anon
)
# TODO: Use background thread instead of subprocess to capture server start events.
# Using a subprocess for server starts is not ideal because the parent immediately enters `uvicorn.run()`
# for http and `asyncio.run()` for stdio which is blocking and prevents the subprocess from starting.
# Therefore we add a small delay to ensure the subprocess has started.
# Assumes that the process creation takes max ~50ms and Python startup takes max ~100ms.
time.sleep(0.15)
def track_tool_call(
self,

View file

@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "arcade-mcp-server"
version = "1.7.2"
version = "1.7.3"
description = "Model Context Protocol (MCP) server framework for Arcade.dev"
readme = "README.md"
authors = [{ name = "Arcade.dev" }]