fix: resolve data engine deployment, optimize logs, update agent rules
This commit is contained in:
1 parent
9b7c41834c
commit
51c8c28a08
65 files changed
+4976
-176
No files matched your search
@@ -38,10 +38,11 @@ class WebSocketClient {
|
||||
return;
|
||||
}
|
||||
|
||||
const wsStart = performance.now();
|
||||
engine.ws = new WebSocket(engineUrl);
|
||||
|
||||
engine.ws.onopen = () => {
|
||||
console.log(`[WSClient] 🟢 Connected to ${engineUrl}`);
|
||||
console.debug(`[WSClient] 🟢 Connected to ${engineUrl}. WS Handshake took ${(performance.now() - wsStart).toFixed(2)}ms`);
|
||||
// Resubscribe to all active plugins on this engine
|
||||
for (const pluginId of engine.subscriptions) {
|
||||
this.send(engine, { action: "subscribe", pluginId });
|
||||
@@ -50,12 +51,13 @@ class WebSocketClient {
|
||||
|
||||
engine.ws.onmessage = (event) => {
|
||||
try {
|
||||
console.log(`[WSClient] 📥 Received raw message:`, event.data.substring(0, 150) + (event.data.length > 150 ? '...' : ''));
|
||||
const msgTime = performance.now();
|
||||
console.debug(`[WSClient] 📥 Received raw message at +${(msgTime - wsStart).toFixed(2)}ms from start:`, event.data.substring(0, 150) + (event.data.length > 150 ? '...' : ''));
|
||||
const data = JSON.parse(event.data);
|
||||
|
||||
// Handle welcome message (informational, no action needed)
|
||||
if (data.type === "welcome") {
|
||||
console.log(`[WSClient] 👋 Engine ${engineUrl} serves: ${data.plugins?.join(", ")}`);
|
||||
console.debug(`[WSClient] 👋 Engine ${engineUrl} serves: ${data.plugins?.join(", ")}`);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -99,7 +101,7 @@ class WebSocketClient {
|
||||
}));
|
||||
}
|
||||
|
||||
console.log(`[WSClient] 🔄 Dispatching ${finalEntities.length} entities for ${data.pluginId} to DataBus`);
|
||||
console.debug(`[WSClient] 🔄 Dispatching ${finalEntities.length} entities for ${data.pluginId} to DataBus`);
|
||||
|
||||
dataBus.emit("dataUpdated", {
|
||||
pluginId: data.pluginId!,
|
||||
@@ -114,7 +116,7 @@ class WebSocketClient {
|
||||
}
|
||||
|
||||
public subscribe(pluginId: string, engineUrl: string) {
|
||||
console.log(`[WSClient] 📡 Subscribing to ${pluginId} at ${engineUrl}`);
|
||||
console.debug(`[WSClient] 📡 Subscribing to ${pluginId} at ${engineUrl}`);
|
||||
const engine = this.getOrCreateEngine(engineUrl);
|
||||
|
||||
// Cancel any pending cleanup
|
||||
|
||||
@@ -20,7 +20,8 @@ export async function fetchLocalEngineManifest(): Promise<string[] | null> {
|
||||
|
||||
try {
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => controller.abort(), 2000);
|
||||
// 500ms is more than enough for a localhost connection.
|
||||
const timeout = setTimeout(() => controller.abort(), 500);
|
||||
|
||||
const res = await fetch(`${getLocalEngineBase()}/manifest`, {
|
||||
signal: controller.signal,
|
||||
@@ -38,7 +39,9 @@ export async function fetchLocalEngineManifest(): Promise<string[] | null> {
|
||||
return localManifest;
|
||||
} catch {
|
||||
console.log("[EngineManifest] No local engine detected, using cloud.");
|
||||
manifestFetched = false;
|
||||
// We intentionally leave manifestFetched = true here.
|
||||
// This caches the failure so we don't incur this timeout penalty
|
||||
// every single time a plugin is toggled.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user