Skip to content

Commit

Permalink
fix runaway workflowId parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Sergeev committed Jan 26, 2024
1 parent e8830b9 commit dbf5651
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/test/StatedWorkflow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,9 @@ test("recover incomplete workflow - should rerun all steps", async () => {
tp.options = {'keepLogs': true}
await tp.initialize();
const {step0, step1, step2} = tp.output;
while(tp.output.step2.log['1697402819332-9q6gg'] === undefined || tp.output.step2.log['1697402819332-9q6gg'].end === undefined){
await new Promise(resolve => setTimeout(resolve, 50)); // Poll every 50ms
}
expect(step0.log['1697402819332-9q6gg'].end).exists;
expect(step1.log['1697402819332-9q6gg'].start).exists;
expect(step1.log['1697402819332-9q6gg'].end).exists;
Expand Down Expand Up @@ -555,14 +558,15 @@ test("recover incomplete workflow - step 1 is incomplete - should rerun steps 1
// keep steps execution logs for debugging
tp.options = {'keepLogs': true}
await tp.initialize();
console.log(tp.output);
const {step0, step1, step2} = tp.output;
expect(step0.log['1697402819332-9q6gg'].end).toBeDefined();
expect(step1.log['1697402819332-9q6gg'].start).toBeDefined();
expect(step1.log['1697402819332-9q6gg'].end).toBeDefined();
while(tp.output.step2.log['1697402819332-9q6gg'] === undefined || tp.output.step2.log['1697402819332-9q6gg'].end === undefined){
await new Promise(resolve => setTimeout(resolve, 50)); // Poll every 50ms
}

expect(step0.log['1697402819332-9q6gg'].end).toBeDefined();
expect(step1.log['1697402819332-9q6gg'].start).toBeDefined();
expect(step1.log['1697402819332-9q6gg'].end).toBeDefined();

expect(step2.log['1697402819332-9q6gg'].start).toBeDefined();
expect(step2.log['1697402819332-9q6gg'].end).toBeDefined();
expect(step2.log['1697402819332-9q6gg'].end.out).toMatchObject({
Expand Down
2 changes: 1 addition & 1 deletion src/workflow/Step.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default class Step {
if (retryCount !== undefined) {
await this.tp.setData(jsonPtr + "/retryCount", ++retryCount);
}
let out = await fn.apply(this, [args]);
let out = await fn.apply(this, [args, {workflowInvocation}]);
const end = {
timestamp: new Date().getTime(),
out
Expand Down

0 comments on commit dbf5651

Please sign in to comment.