Fix race condition waiting for message delivery
This commit is contained in:
parent
9feab409ab
commit
d9bd0c6e30
@ -79,7 +79,6 @@ final class DeviceManager {
|
|||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
try await socket.send(Array(message))
|
try await socket.send(Array(message))
|
||||||
await updateMessageCountMetric()
|
|
||||||
} catch {
|
} catch {
|
||||||
throw MessageResult.deviceNotConnected
|
throw MessageResult.deviceNotConnected
|
||||||
}
|
}
|
||||||
@ -88,6 +87,7 @@ final class DeviceManager {
|
|||||||
let result: Data = try await withCheckedThrowingContinuation { continuation in
|
let result: Data = try await withCheckedThrowingContinuation { continuation in
|
||||||
self.requestInProgress = continuation
|
self.requestInProgress = continuation
|
||||||
}
|
}
|
||||||
|
await updateMessageCountMetric()
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,6 +163,7 @@ final class DeviceManager {
|
|||||||
self?.didCloseDeviceSocket()
|
self?.didCloseDeviceSocket()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log("[INFO] Socket connected")
|
||||||
await updateDeviceConnectionMetric()
|
await updateDeviceConnectionMetric()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user