Skip to content

Commit f3a5175

Browse files
Restore parent context in workflow stubs
1 parent 7393ea5 commit f3a5175

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/ActivityStub.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public static function make($activity, ...$arguments): PromiseInterface
6464
}
6565

6666
++$context->index;
67+
WorkflowStub::setContext($context);
6768
$result = Serializer::unserialize($log->result);
6869
if (
6970
is_array($result) &&
@@ -87,12 +88,14 @@ public static function make($activity, ...$arguments): PromiseInterface
8788

8889
if (WorkflowStub::isProbing()) {
8990
++$context->index;
91+
WorkflowStub::setContext($context);
9092
return (new Deferred())->promise();
9193
}
9294

9395
$activity::dispatch($context->index, $context->now, $context->storedWorkflow, ...$arguments);
9496

9597
++$context->index;
98+
WorkflowStub::setContext($context);
9699
return (new Deferred())->promise();
97100
}
98101
}

src/ChildWorkflowStub.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public static function make($workflow, ...$arguments): PromiseInterface
5858
}
5959

6060
++$context->index;
61+
WorkflowStub::setContext($context);
6162
$result = Serializer::unserialize($log->result);
6263
if (
6364
is_array($result)
@@ -80,6 +81,7 @@ public static function make($workflow, ...$arguments): PromiseInterface
8081

8182
if (WorkflowStub::isProbing()) {
8283
++$context->index;
84+
WorkflowStub::setContext($context);
8385
return (new Deferred())->promise();
8486
}
8587

@@ -109,6 +111,7 @@ public static function make($workflow, ...$arguments): PromiseInterface
109111
}
110112

111113
++$context->index;
114+
WorkflowStub::setContext($context);
112115
return (new Deferred())->promise();
113116
}
114117
}

0 commit comments

Comments
 (0)