Skip to content

Commit 76a8f12

Browse files
Send password generation and username fetching in parallel.
1 parent 7d98684 commit 76a8f12

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Networking/Networking/ApplicationPassword/ApplicationPasswordUseCase.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,17 @@ final class DefaultApplicationPasswordUseCase: ApplicationPasswordUseCase {
9494
/// - Returns: Generated `ApplicationPassword` instance
9595
///
9696
func generateNewPassword() async throws -> ApplicationPassword {
97-
let password = try await {
97+
async let password = try {
9898
do {
9999
return try await createApplicationPasswordUsingWPCOMAuthToken()
100100
} catch ApplicationPasswordUseCaseError.duplicateName {
101101
try await deletePassword()
102102
return try await createApplicationPasswordUsingWPCOMAuthToken()
103103
}
104104
}()
105-
let username = try await fetchWPAdminUsername()
105+
async let username = try fetchWPAdminUsername()
106106

107-
let applicationPassword = ApplicationPassword(wpOrgUsername: username, password: Secret(password))
107+
let applicationPassword = try await ApplicationPassword(wpOrgUsername: username, password: Secret(password))
108108
saveApplicationPassword(applicationPassword)
109109
return applicationPassword
110110
}

0 commit comments

Comments
 (0)