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:
parent
a770edca4a
commit
139cc2e54d
2 changed files with 8 additions and 1 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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" }]
|
||||
|
|
|
|||
Loading…
Reference in a new issue