@bian-womp/spark-graph 0.3.87 → 0.3.88
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 -0
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/cjs/src/runtime/GraphRuntime.d.ts +2 -0
- package/lib/cjs/src/runtime/GraphRuntime.d.ts.map +1 -1
- package/lib/esm/index.js +18 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/src/runtime/GraphRuntime.d.ts +2 -0
- package/lib/esm/src/runtime/GraphRuntime.d.ts.map +1 -1
- package/package.json +2 -2
package/lib/cjs/index.cjs
CHANGED
|
@@ -3825,6 +3825,7 @@ class GraphRuntime {
|
|
|
3825
3825
|
this.runMode = "manual";
|
|
3826
3826
|
this.pauseRefCount = 0;
|
|
3827
3827
|
this.persistentPauseToken = null;
|
|
3828
|
+
this.deferredAutoRunNodeIds = new Set();
|
|
3828
3829
|
// Initialize components
|
|
3829
3830
|
this.eventEmitter = new EventEmitter();
|
|
3830
3831
|
this.graph = new Graph(this.eventEmitter);
|
|
@@ -3953,6 +3954,10 @@ class GraphRuntime {
|
|
|
3953
3954
|
const canExecute = this.graph.allInboundHaveValue(nodeId);
|
|
3954
3955
|
if (!shouldAutoRun || !canExecute)
|
|
3955
3956
|
return;
|
|
3957
|
+
if (this.isPaused()) {
|
|
3958
|
+
this.deferredAutoRunNodeIds.add(nodeId);
|
|
3959
|
+
return;
|
|
3960
|
+
}
|
|
3956
3961
|
this.withManualNoPropagateContext(nodeId, (runContextIds) => {
|
|
3957
3962
|
this.execute(nodeId, {
|
|
3958
3963
|
runContextIds,
|
|
@@ -3960,6 +3965,15 @@ class GraphRuntime {
|
|
|
3960
3965
|
});
|
|
3961
3966
|
});
|
|
3962
3967
|
}
|
|
3968
|
+
flushDeferredAutoRunNodes() {
|
|
3969
|
+
if (this.isPaused() || this.deferredAutoRunNodeIds.size === 0)
|
|
3970
|
+
return;
|
|
3971
|
+
const queuedNodeIds = Array.from(this.deferredAutoRunNodeIds);
|
|
3972
|
+
this.deferredAutoRunNodeIds.clear();
|
|
3973
|
+
for (const nodeId of queuedNodeIds) {
|
|
3974
|
+
this.executeNodeAutoRun(nodeId, { reason: "deferred-auto-run" });
|
|
3975
|
+
}
|
|
3976
|
+
}
|
|
3963
3977
|
setInputs(nodeId, inputs) {
|
|
3964
3978
|
const node = this.graph.getNode(nodeId);
|
|
3965
3979
|
if (!node)
|
|
@@ -4216,6 +4230,10 @@ class GraphRuntime {
|
|
|
4216
4230
|
return;
|
|
4217
4231
|
released = true;
|
|
4218
4232
|
this.pauseRefCount--;
|
|
4233
|
+
if (this.pauseRefCount <= 0) {
|
|
4234
|
+
this.pauseRefCount = 0;
|
|
4235
|
+
this.flushDeferredAutoRunNodes();
|
|
4236
|
+
}
|
|
4219
4237
|
};
|
|
4220
4238
|
}
|
|
4221
4239
|
isPaused() {
|