Skip to content

Commit f1f01c7

Browse files
authored
[Auth] Await header value from underlying queue (#13647)
1 parent e3822e6 commit f1f01c7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

FirebaseAuth/Sources/Swift/Backend/AuthBackend.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ class AuthBackend: NSObject {
109109
request.setValue(Bundle.main.bundleIdentifier, forHTTPHeaderField: "X-Ios-Bundle-Identifier")
110110
request.setValue(requestConfiguration.appID, forHTTPHeaderField: "X-Firebase-GMPID")
111111
if let heartbeatLogger = requestConfiguration.heartbeatLogger {
112-
request.setValue(heartbeatLogger.headerValue(), forHTTPHeaderField: "X-Firebase-Client")
112+
// The below call synchronously dispatches to a queue. To avoid blocking
113+
// the shared concurrency queue, `async let` will spawn the process on
114+
// a separate thread.
115+
async let heartbeatsHeaderValue = heartbeatLogger.headerValue()
116+
await request.setValue(heartbeatsHeaderValue, forHTTPHeaderField: "X-Firebase-Client")
113117
}
114118
request.httpMethod = requestConfiguration.httpMethod
115119
let preferredLocalizations = Bundle.main.preferredLocalizations

0 commit comments

Comments
 (0)