@bian-womp/spark-remote 0.3.51 → 0.3.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.cjs +18 -1
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/server/ServerRuntimeAdapter.d.ts.map +1 -1
- package/lib/cjs/src/server/errors.d.ts.map +1 -1
- package/lib/esm/index.js +18 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/server/ServerRuntimeAdapter.d.ts.map +1 -1
- package/lib/esm/src/server/errors.d.ts.map +1 -1
- package/package.json +3 -3
package/lib/cjs/index.cjs
CHANGED
|
@@ -327,7 +327,6 @@ class HttpPollingTransport {
|
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
331
330
|
function summarize(value, maxLen = 120) {
|
|
332
331
|
try {
|
|
333
332
|
const s = typeof value === "string" ? value : JSON.stringify(value);
|
|
@@ -447,6 +446,24 @@ async function createServerRuntimeAdapter(id, createRegistry, send, extensions)
|
|
|
447
446
|
});
|
|
448
447
|
},
|
|
449
448
|
build: async (def, opts) => {
|
|
449
|
+
// If we rebuild the graph, we must not keep the previous runtime/engine alive.
|
|
450
|
+
// This can happen for a single "flow" when:
|
|
451
|
+
// - server bootstraps an empty graph (no snapshot) then client sends Build with real def
|
|
452
|
+
// - snapshot load / applySnapshotFull triggers a build
|
|
453
|
+
// - client intentionally rebuilds the graph
|
|
454
|
+
//
|
|
455
|
+
// Without disposing, we can end up with multiple GraphRuntime instances in memory
|
|
456
|
+
// for the same flow/connection, each holding listeners/resources.
|
|
457
|
+
if (engine) {
|
|
458
|
+
console.info(`[ServerRuntimeAdapter:${id}] Disposing previous engine before building new one`);
|
|
459
|
+
engine.dispose();
|
|
460
|
+
engine = undefined;
|
|
461
|
+
}
|
|
462
|
+
if (graphRuntime) {
|
|
463
|
+
console.info(`[ServerRuntimeAdapter:${id}] Disposing previous graph runtime before building new one`);
|
|
464
|
+
graphRuntime.dispose();
|
|
465
|
+
graphRuntime = undefined;
|
|
466
|
+
}
|
|
450
467
|
const environment = opts?.environment || {};
|
|
451
468
|
graphRuntime = builder.build(def, {
|
|
452
469
|
environment,
|