1
0
Fork 0
mirror of synced 2024-07-01 20:50:49 +12:00

Fix sleep wait

This commit is contained in:
Jake Barnby 2023-08-28 23:15:02 -04:00
parent f43f155224
commit 49fa5550bb
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C

View file

@ -1294,8 +1294,23 @@ class RealtimeCustomClientTest extends Scope
$this->assertEquals($deployment['headers']['status-code'], 202);
$this->assertNotEmpty($deployment['body']['$id']);
// Wait for deployment to be built.
sleep(10);
// Poll until deployment is built
while (true) {
$deployment = $this->client->call(Client::METHOD_GET, '/functions/' . $function['body']['$id'] . '/deployments/' . $deploymentId, [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey'],
]);
if (
$deployment['headers']['status-code'] >= 400
|| \in_array($deployment['body']['status'], ['ready', 'failed'])
) {
break;
}
\sleep(1);
}
$response = $this->client->call(Client::METHOD_PATCH, '/functions/' . $functionId . '/deployments/' . $deploymentId, array_merge([
'content-type' => 'application/json',