@@ -6103,21 +6103,19 @@ def __init__(
61036103 self .ping_pong_val = 1
61046104 self .ping_pong_counter = 0
61056105 self .ping_pong_max_count = 4
6106- self .run_finished = False
61076106
61086107 @workflow .run
61096108 async def run (self ) -> str :
61106109 await workflow .wait_condition (
61116110 lambda : self .seen_first_signal and self .seen_second_signal
61126111 )
6113- self .run_finished = True
61146112 return "workflow-result"
61156113
61166114 @workflow .signal
61176115 async def this_signal_executes_first (self ):
61186116 self .seen_first_signal = True
61196117 if self .main_workflow_returns_before_signal_completions :
6120- await workflow . wait_condition (lambda : self .run_finished )
6118+ await self . ping_pong (lambda : self .ping_pong_val > 0 )
61216119 raise ApplicationError (
61226120 "Client should see this error unless doing ping-pong "
61236121 "(in which case main coroutine returns first)"
@@ -6128,7 +6126,7 @@ async def this_signal_executes_second(self):
61286126 await workflow .wait_condition (lambda : self .seen_first_signal )
61296127 self .seen_second_signal = True
61306128 if self .main_workflow_returns_before_signal_completions :
6131- await workflow . wait_condition (lambda : self .run_finished )
6129+ await self . ping_pong (lambda : self .ping_pong_val < 0 )
61326130 raise ApplicationError ("Client should never see this error!" )
61336131
61346132 async def ping_pong (self , cond : Callable [[], bool ]):
0 commit comments