Skip to content

Commit dc9c0c5

Browse files
authored
chore: reduce process waiting timeouts (#680)
1 parent fde083d commit dc9c0c5

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

testing/src/Environment.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,18 @@ public function startTemporalServer(
101101
);
102102
$this->temporalServerProcess->setTimeout($commandTimeout);
103103
$this->temporalServerProcess->start();
104-
$this->output->writeln('<info>done.</info>');
105-
\sleep(1);
104+
105+
$limit = 1_000_000;
106+
while (!$this->temporalServerProcess->isRunning() && $limit > 0) {
107+
\usleep($limit -= 1000);
108+
}
106109

107110
if (!$this->temporalServerProcess->isRunning()) {
108111
$this->output->writeln('<error>error</error>');
109112
$this->output->writeln('Error starting Temporal server: ' . $this->temporalServerProcess->getErrorOutput());
110113
exit(1);
111114
}
115+
$this->output->writeln('<info>done.</info>');
112116
}
113117

114118
public function startTemporalTestServer(int $commandTimeout = 10): void
@@ -127,14 +131,18 @@ public function startTemporalTestServer(int $commandTimeout = 10): void
127131
);
128132
$this->temporalTestServerProcess->setTimeout($commandTimeout);
129133
$this->temporalTestServerProcess->start();
130-
$this->output->writeln('<info>done.</info>');
131-
\sleep(1);
134+
135+
$limit = 1_000_000;
136+
while (!$this->temporalTestServerProcess->isRunning() && $limit > 0) {
137+
\usleep($limit -= 1000);
138+
}
132139

133140
if (!$this->temporalTestServerProcess->isRunning()) {
134141
$this->output->writeln('<error>error</error>');
135142
$this->output->writeln('Error starting Temporal Test server: ' . $this->temporalTestServerProcess->getErrorOutput());
136143
exit(1);
137144
}
145+
$this->output->writeln('<info>done.</info>');
138146
}
139147

140148
/**

0 commit comments

Comments
 (0)