Skip to content

Commit 166acfa

Browse files
authored
Use serial queue for Tic Tac Toe authorization (#320)
1 parent fbd8934 commit 166acfa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Examples/TicTacToe/Sources/Core/LiveAuthenticationClient.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ extension AuthenticationClient {
99
(request.email.contains("@") && request.password == "password"
1010
? Effect(value: .init(token: "deadbeef", twoFactorRequired: request.email.contains("2fa")))
1111
: Effect(error: .invalidUserPassword))
12-
.delay(for: 1, scheduler: DispatchQueue.global())
12+
.delay(for: 1, scheduler: queue)
1313
.eraseToEffect()
1414
},
1515
twoFactor: { request in
@@ -18,7 +18,9 @@ extension AuthenticationClient {
1818
: request.code != "1234"
1919
? Effect(error: .invalidTwoFactor)
2020
: Effect(value: .init(token: "deadbeefdeadbeef", twoFactorRequired: false)))
21-
.delay(for: 1, scheduler: DispatchQueue.global())
21+
.delay(for: 1, scheduler: queue)
2222
.eraseToEffect()
2323
})
2424
}
25+
26+
private let queue = DispatchQueue(label: "AuthenticationClient")

0 commit comments

Comments
 (0)