Skip to content

Commit 73a047d

Browse files
fix: add conditional sleep for retry logic in database user readiness check
1 parent c58ff1a commit 73a047d

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/Database/Manager/MittwaldApi.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,6 @@ private function getDatabaseUser(string $id): MysqlUser
201201
return $response->getBody();
202202
}
203203

204-
/**
205-
* @throws Exception
206-
* @throws \Exception
207-
*/
208204
private function initDatabaseConfiguration(MySqlDatabase $database, MySqlUser $user): void
209205
{
210206
set('database_user', $user->getName());
@@ -234,7 +230,9 @@ private function checkForDatabaseReadyStatus(string $mysqlUserId, int $waitingTi
234230
// Optionally: break on certain errors
235231
}
236232

237-
sleep($waitingTime);
233+
if ($maxRetries > 1) {
234+
sleep($waitingTime);
235+
}
238236
$maxRetries--;
239237
}
240238
debug("MySQL user {$mysqlUserId} is not ready after all attempts.");

0 commit comments

Comments
 (0)