@@ -41,13 +41,15 @@ public static function check(
4141 StartWorkflowAction::new ('Harness_Schedule_Basic ' )
4242 ->withWorkflowId ($ workflowId )
4343 ->withTaskQueue ($ feature ->taskQueue )
44- ->withInput (['arg1 ' ])
45- )->withSpec (
44+ ->withInput (['arg1 ' ]),
45+ )
46+ ->withSpec (
4647 ScheduleSpec::new ()
47- ->withIntervalList ($ interval )
48- )->withPolicies (
48+ ->withIntervalList ($ interval ),
49+ )
50+ ->withPolicies (
4951 SchedulePolicies::new ()
50- ->withOverlapPolicy (ScheduleOverlapPolicy::BufferOne)
52+ ->withOverlapPolicy (ScheduleOverlapPolicy::BufferOne),
5153 ),
5254 options: ScheduleOptions::new ()
5355 ->withNamespace ($ runtime ->namespace ),
@@ -66,19 +68,22 @@ public static function check(
6668
6769 // Confirm simple list
6870 $ found = false ;
69- $ findDeadline = \microtime (true ) + 10 ;
70- find:
71- foreach ($ scheduleClient ->listSchedules () as $ schedule ) {
72- if ($ schedule ->scheduleId === $ scheduleId ) {
73- $ found = true ;
74- break ;
71+ $ findDeadline = \microtime (true ) + 2 ;
72+ while (!$ found ) {
73+ foreach ($ scheduleClient ->listSchedules () as $ schedule ) {
74+ if ($ schedule ->scheduleId === $ scheduleId ) {
75+ $ found = true ;
76+ break ;
77+ }
7578 }
76- }
77- if (!$ found and \microtime (true ) < $ findDeadline ) {
78- goto find;
79- }
8079
81- $ found or throw new \Exception ('Schedule not found ' );
80+ if (!$ found ) {
81+ if (\microtime (true ) >= $ findDeadline ) {
82+ throw new \Exception ('Schedule not found ' );
83+ }
84+ \usleep (100_000 );
85+ }
86+ }
8287
8388 // Wait for first completion
8489 while ($ handle ->describe ()->info ->numActions < 1 ) {
@@ -93,14 +98,14 @@ public static function check(
9398 $ result = $ workflowClient ->newUntypedRunningWorkflowStub (
9499 $ lastAction ->startWorkflowResult ->getID (),
95100 $ lastAction ->startWorkflowResult ->getRunID (),
96- workflowType: 'Workflow '
101+ workflowType: 'Workflow ' ,
97102 )->getResult ();
98103 self ::assertSame ('arg1 ' , $ result );
99104
100105 // Update and change arg
101106 $ handle ->update (
102107 $ description ->schedule ->withAction (
103- $ action ->withInput (['arg2 ' ])
108+ $ action ->withInput (['arg2 ' ]),
104109 ),
105110 );
106111 $ numActions = $ handle ->describe ()->info ->numActions ;
@@ -119,7 +124,7 @@ public static function check(
119124 $ result = $ workflowClient ->newUntypedRunningWorkflowStub (
120125 $ lastAction ->startWorkflowResult ->getID (),
121126 $ lastAction ->startWorkflowResult ->getRunID (),
122- workflowType: 'Workflow '
127+ workflowType: 'Workflow ' ,
123128 )->getResult ();
124129 self ::assertSame ('arg2 ' , $ result );
125130 } finally {
0 commit comments