Device: Add mutex for disk info requests to temporarily work around WiVIClient timeout issues

This commit is contained in:
Jonathan Schwartz
2022-04-22 17:30:53 +00:00
committed by Paul Hollinsky
parent c2de1dfdf1
commit 44ad06d4bb
+6
View File
@@ -528,6 +528,9 @@ optional<bool> Device::isLogicalDiskConnected() {
return nullopt;
}
// This doesn't *really* make sense here but because the disk read redirects the parser until it is done, we'll lock this
// just to avoid the timeout.
std::lock_guard<std::mutex> lg(diskLock);
const auto info = com->getLogicalDiskInfoSync();
if (!info) {
report(APIEvent::Type::Timeout, APIEvent::Severity::Error);
@@ -543,6 +546,9 @@ optional<uint64_t> Device::getLogicalDiskSize() {
return nullopt;
}
// This doesn't *really* make sense here but because the disk read redirects the parser until it is done, we'll lock this
// just to avoid the timeout.
std::lock_guard<std::mutex> lg(diskLock);
const auto info = com->getLogicalDiskInfoSync();
if (!info) {
report(APIEvent::Type::Timeout, APIEvent::Severity::Error);