File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
sdk/src/main/java/com/amazonaws/lambda/durable/operation Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -136,14 +136,15 @@ protected Operation waitForOperationCompletion() {
136136
137137 validateCurrentThreadType ();
138138
139+ // register to prevent the state from advancing
140+ phaser .register ();
141+
139142 // If we are in a replay where the operation is already complete (SUCCEEDED /
140143 // FAILED), the Phaser will be
141144 // advanced in .execute() already and we don't block but return the result
142145 // immediately.
143146 if (phaser .getPhase () == ExecutionPhase .RUNNING .getValue ()) {
144147 // Operation not done yet
145- phaser .register ();
146-
147148 var context = executionManager .getCurrentContext ();
148149 // Deregister current context - allows suspension
149150 logger .debug (
@@ -162,6 +163,9 @@ protected Operation waitForOperationCompletion() {
162163
163164 // Complete phase 1
164165 phaser .arriveAndDeregister ();
166+ } else {
167+ // The phaser is already completed. Deregister now.
168+ phaser .arriveAndDeregister ();
165169 }
166170
167171 // Get result based on status
You can’t perform that action at this time.
0 commit comments