@@ -6103,19 +6103,21 @@ 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
61066107
61076108 @workflow .run
61086109 async def run (self ) -> str :
61096110 await workflow .wait_condition (
61106111 lambda : self .seen_first_signal and self .seen_second_signal
61116112 )
6113+ self .run_finished = True
61126114 return "workflow-result"
61136115
61146116 @workflow .signal
61156117 async def this_signal_executes_first (self ):
61166118 self .seen_first_signal = True
61176119 if self .main_workflow_returns_before_signal_completions :
6118- await self . ping_pong (lambda : self .ping_pong_val > 0 )
6120+ await workflow . wait_condition (lambda : self .run_finished )
61196121 raise ApplicationError (
61206122 "Client should see this error unless doing ping-pong "
61216123 "(in which case main coroutine returns first)"
@@ -6126,7 +6128,7 @@ async def this_signal_executes_second(self):
61266128 await workflow .wait_condition (lambda : self .seen_first_signal )
61276129 self .seen_second_signal = True
61286130 if self .main_workflow_returns_before_signal_completions :
6129- await self . ping_pong (lambda : self .ping_pong_val < 0 )
6131+ await workflow . wait_condition (lambda : self .run_finished )
61306132 raise ApplicationError ("Client should never see this error!" )
61316133
61326134 async def ping_pong (self , cond : Callable [[], bool ]):
0 commit comments