fix: Add retry for admin client sign in for test (#5767)

This commit is contained in:
Khor Shu Heng 2024-07-22 10:02:01 +08:00 committed by GitHub
parent d5544af6c5
commit e426970eed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -620,9 +620,18 @@ async fn get_admin_client(client: &Arc<AFCloudClient>) -> FlowyResult<Client> {
ClientConfiguration::default(),
&client.client_version.to_string(),
);
admin_client
// When multiple admin_client instances attempt to sign in concurrently, multiple admin user
// creation transaction will be created, but only the first attempt will succeed due to the
// unique email constraint. Once the user has been created, admin_client instances can sign in
// concurrently without issue.
let resp = admin_client
.sign_in_password(&admin_email, &admin_password)
.await?;
.await;
if resp.is_err() {
admin_client
.sign_in_password(&admin_email, &admin_password)
.await?;
};
Ok(admin_client)
}