fix: MCP server on Task.Run + start after 10th frame
- Changed from Thread to Task.Run for MCP server - Start delay: 10 frames (was 3) — let scene fully initialize first - Kestrel on ThreadPool instead of dedicated thread
This commit is contained in:
@@ -81,12 +81,12 @@ class Program
|
|||||||
|
|
||||||
#if !RELEASE_AOT
|
#if !RELEASE_AOT
|
||||||
frameCount++;
|
frameCount++;
|
||||||
if (mcpPort > 0 && !mcpStarted && frameCount > 3)
|
if (mcpPort > 0 && !mcpStarted && frameCount > 10)
|
||||||
{
|
{
|
||||||
mcpStarted = true;
|
mcpStarted = true;
|
||||||
var port = mcpPort;
|
var port = mcpPort;
|
||||||
var q = queue;
|
var q = queue;
|
||||||
new Thread(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -98,7 +98,7 @@ class Program
|
|||||||
{
|
{
|
||||||
Console.WriteLine($"[App] MCP server error: {ex.Message}");
|
Console.WriteLine($"[App] MCP server error: {ex.Message}");
|
||||||
}
|
}
|
||||||
}) { IsBackground = true }.Start();
|
});
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user