@falcondev-oss/workflow 0.8.4 → 0.8.5
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/index.mjs +8 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -9622,12 +9622,16 @@ var WorkflowStep = class WorkflowStep {
|
|
|
9622
9622
|
async do(stepName, run, options) {
|
|
9623
9623
|
const name = this.addNamePrefix(stepName);
|
|
9624
9624
|
const stepData = await this.getStepData("do", name);
|
|
9625
|
-
if (stepData && "result" in stepData)
|
|
9625
|
+
if (stepData && "result" in stepData) {
|
|
9626
|
+
Settings.logger?.debug?.(`[${this.workflowId}/${this.workflowJobId}] Step '${name}' already completed, returning cached result`);
|
|
9627
|
+
return stepData.result;
|
|
9628
|
+
}
|
|
9626
9629
|
const initialAttempt = stepData?.attempt ?? 0;
|
|
9627
9630
|
await this.updateStepData(name, {
|
|
9628
9631
|
type: "do",
|
|
9629
9632
|
attempt: initialAttempt
|
|
9630
9633
|
});
|
|
9634
|
+
Settings.logger?.debug?.(`[${this.workflowId}/${this.workflowJobId}] Running step '${name}' (attempt ${initialAttempt + 1})`);
|
|
9631
9635
|
return pRetry(async (attempt) => {
|
|
9632
9636
|
const result = await runWithTracing(`workflow-worker/${this.workflowId}/step/${name}`, { attributes: {
|
|
9633
9637
|
"workflow.id": this.workflowId,
|
|
@@ -9648,11 +9652,13 @@ var WorkflowStep = class WorkflowStep {
|
|
|
9648
9652
|
result,
|
|
9649
9653
|
attempt: initialAttempt + attempt
|
|
9650
9654
|
});
|
|
9655
|
+
Settings.logger?.debug?.(`[${this.workflowId}/${this.workflowJobId}] Completed step '${name}'`);
|
|
9651
9656
|
return result;
|
|
9652
9657
|
}, {
|
|
9653
9658
|
...options?.retry,
|
|
9654
9659
|
retries: Math.max((options?.retry?.retries ?? 0) - initialAttempt, 0),
|
|
9655
9660
|
onFailedAttempt: async (ctx) => {
|
|
9661
|
+
Settings.logger?.debug?.(`[${this.workflowId}/${this.workflowJobId}] Step '${name}' error:`, ctx.error);
|
|
9656
9662
|
await this.updateStepData(name, {
|
|
9657
9663
|
type: "do",
|
|
9658
9664
|
attempt: initialAttempt + ctx.attemptNumber
|
|
@@ -9676,6 +9682,7 @@ var WorkflowStep = class WorkflowStep {
|
|
|
9676
9682
|
"workflow.job_id": this.workflowJobId,
|
|
9677
9683
|
"workflow.step_name": name
|
|
9678
9684
|
} }, async () => {
|
|
9685
|
+
Settings.logger?.debug?.(`[${this.workflowId}/${this.workflowJobId}] Waiting in step '${name}' for ${durationMs} ms`);
|
|
9679
9686
|
await setTimeout$1(Math.max(0, stepData.startedAt + stepData.durationMs - now));
|
|
9680
9687
|
});
|
|
9681
9688
|
}
|
package/package.json
CHANGED