@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.
@@ -19078,6 +19078,7 @@ declare class DevRuntimeManager implements RuntimeManager {
19078
19078
  reject: (err?: any) => void;
19079
19079
  }>;
19080
19080
  _tasks: Map<string, TaskMetadataWithFilePath>;
19081
+ _pendingCompletionNotifications: Map<string, TaskRunExecutionResult>;
19081
19082
  disable(): void;
19082
19083
  registerTasks(tasks: TaskMetadataWithFilePath[]): void;
19083
19084
  getTaskMetadata(id: string): TaskMetadataWithFilePath | undefined;
@@ -19078,6 +19078,7 @@ declare class DevRuntimeManager implements RuntimeManager {
19078
19078
  reject: (err?: any) => void;
19079
19079
  }>;
19080
19080
  _tasks: Map<string, TaskMetadataWithFilePath>;
19081
+ _pendingCompletionNotifications: Map<string, TaskRunExecutionResult>;
19081
19082
  disable(): void;
19082
19083
  registerTasks(tasks: TaskMetadataWithFilePath[]): void;
19083
19084
  getTaskMetadata(id: string): TaskMetadataWithFilePath | undefined;
package/dist/v3/index.js CHANGED
@@ -2724,6 +2724,7 @@ var _DevRuntimeManager = class _DevRuntimeManager {
2724
2724
  __publicField(this, "_taskWaits", /* @__PURE__ */ new Map());
2725
2725
  __publicField(this, "_batchWaits", /* @__PURE__ */ new Map());
2726
2726
  __publicField(this, "_tasks", /* @__PURE__ */ new Map());
2727
+ __publicField(this, "_pendingCompletionNotifications", /* @__PURE__ */ new Map());
2727
2728
  }
2728
2729
  disable() {
2729
2730
  }
@@ -2746,6 +2747,11 @@ var _DevRuntimeManager = class _DevRuntimeManager {
2746
2747
  });
2747
2748
  }
2748
2749
  async waitForTask(params) {
2750
+ const pendingCompletion = this._pendingCompletionNotifications.get(params.id);
2751
+ if (pendingCompletion) {
2752
+ this._pendingCompletionNotifications.delete(params.id);
2753
+ return pendingCompletion;
2754
+ }
2749
2755
  const promise = new Promise((resolve, reject) => {
2750
2756
  this._taskWaits.set(params.id, {
2751
2757
  resolve,
@@ -2763,6 +2769,16 @@ var _DevRuntimeManager = class _DevRuntimeManager {
2763
2769
  }
2764
2770
  const promise = Promise.all(params.runs.map((runId) => {
2765
2771
  return new Promise((resolve, reject) => {
2772
+ const pendingCompletion = this._pendingCompletionNotifications.get(runId);
2773
+ if (pendingCompletion) {
2774
+ this._pendingCompletionNotifications.delete(runId);
2775
+ if (pendingCompletion.ok) {
2776
+ resolve(pendingCompletion);
2777
+ } else {
2778
+ reject(pendingCompletion);
2779
+ }
2780
+ return;
2781
+ }
2766
2782
  this._taskWaits.set(runId, {
2767
2783
  resolve,
2768
2784
  reject
@@ -2776,13 +2792,9 @@ var _DevRuntimeManager = class _DevRuntimeManager {
2776
2792
  };
2777
2793
  }
2778
2794
  resumeTask(completion, execution) {
2779
- console.log(JSON.stringify({
2780
- message: "devRuntimeManager resumeTask",
2781
- runId: execution.run.id,
2782
- taskWaitIds: Array.from(this._taskWaits.keys())
2783
- }));
2784
2795
  const wait = this._taskWaits.get(execution.run.id);
2785
2796
  if (!wait) {
2797
+ this._pendingCompletionNotifications.set(execution.run.id, completion);
2786
2798
  return;
2787
2799
  }
2788
2800
  if (completion.ok) {