@trigger.dev/core 0.0.0-v3-canary-20240322110240 → 0.0.0-v3-canary-20240322112439
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/dist/v3/index.d.mts +1 -0
- package/dist/v3/index.d.ts +1 -0
- package/dist/v3/index.js +17 -5
- package/dist/v3/index.js.map +1 -1
- package/dist/v3/index.mjs +17 -5
- package/dist/v3/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/v3/index.mjs
CHANGED
|
@@ -2716,6 +2716,7 @@ var _DevRuntimeManager = class _DevRuntimeManager {
|
|
|
2716
2716
|
__publicField(this, "_taskWaits", /* @__PURE__ */ new Map());
|
|
2717
2717
|
__publicField(this, "_batchWaits", /* @__PURE__ */ new Map());
|
|
2718
2718
|
__publicField(this, "_tasks", /* @__PURE__ */ new Map());
|
|
2719
|
+
__publicField(this, "_pendingCompletionNotifications", /* @__PURE__ */ new Map());
|
|
2719
2720
|
}
|
|
2720
2721
|
disable() {
|
|
2721
2722
|
}
|
|
@@ -2738,6 +2739,11 @@ var _DevRuntimeManager = class _DevRuntimeManager {
|
|
|
2738
2739
|
});
|
|
2739
2740
|
}
|
|
2740
2741
|
async waitForTask(params) {
|
|
2742
|
+
const pendingCompletion = this._pendingCompletionNotifications.get(params.id);
|
|
2743
|
+
if (pendingCompletion) {
|
|
2744
|
+
this._pendingCompletionNotifications.delete(params.id);
|
|
2745
|
+
return pendingCompletion;
|
|
2746
|
+
}
|
|
2741
2747
|
const promise = new Promise((resolve, reject) => {
|
|
2742
2748
|
this._taskWaits.set(params.id, {
|
|
2743
2749
|
resolve,
|
|
@@ -2755,6 +2761,16 @@ var _DevRuntimeManager = class _DevRuntimeManager {
|
|
|
2755
2761
|
}
|
|
2756
2762
|
const promise = Promise.all(params.runs.map((runId) => {
|
|
2757
2763
|
return new Promise((resolve, reject) => {
|
|
2764
|
+
const pendingCompletion = this._pendingCompletionNotifications.get(runId);
|
|
2765
|
+
if (pendingCompletion) {
|
|
2766
|
+
this._pendingCompletionNotifications.delete(runId);
|
|
2767
|
+
if (pendingCompletion.ok) {
|
|
2768
|
+
resolve(pendingCompletion);
|
|
2769
|
+
} else {
|
|
2770
|
+
reject(pendingCompletion);
|
|
2771
|
+
}
|
|
2772
|
+
return;
|
|
2773
|
+
}
|
|
2758
2774
|
this._taskWaits.set(runId, {
|
|
2759
2775
|
resolve,
|
|
2760
2776
|
reject
|
|
@@ -2768,13 +2784,9 @@ var _DevRuntimeManager = class _DevRuntimeManager {
|
|
|
2768
2784
|
};
|
|
2769
2785
|
}
|
|
2770
2786
|
resumeTask(completion, execution) {
|
|
2771
|
-
console.log(JSON.stringify({
|
|
2772
|
-
message: "devRuntimeManager resumeTask",
|
|
2773
|
-
runId: execution.run.id,
|
|
2774
|
-
taskWaitIds: Array.from(this._taskWaits.keys())
|
|
2775
|
-
}));
|
|
2776
2787
|
const wait = this._taskWaits.get(execution.run.id);
|
|
2777
2788
|
if (!wait) {
|
|
2789
|
+
this._pendingCompletionNotifications.set(execution.run.id, completion);
|
|
2778
2790
|
return;
|
|
2779
2791
|
}
|
|
2780
2792
|
if (completion.ok) {
|