From caead9ef318aba53f77e89664658ed9dfaee043b Mon Sep 17 00:00:00 2001 From: James Fantin-Hardesty <24646452+jfantinhardesty@users.noreply.github.com> Date: Tue, 2 Jul 2024 11:38:50 -0600 Subject: [PATCH] Improve windows retry loop --- .../analytics/stub/settings/engine.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/samples/cloudfuse_plugin/src/nx/vms_server_plugins/analytics/stub/settings/engine.cpp b/samples/cloudfuse_plugin/src/nx/vms_server_plugins/analytics/stub/settings/engine.cpp index ee34da9..7abbfb4 100644 --- a/samples/cloudfuse_plugin/src/nx/vms_server_plugins/analytics/stub/settings/engine.cpp +++ b/samples/cloudfuse_plugin/src/nx/vms_server_plugins/analytics/stub/settings/engine.cpp @@ -333,12 +333,15 @@ Result Engine::settingsReceived() return error(ErrorCode::internalError, "Unable to launch mount with error: " + mountRet.output); } -// On Windows, mount does not show up immediately, so need to wait -#ifdef _WIN32 - Sleep(5000); -#endif + // Mount might not show up immediately, so wait for mount to appear + int retryCount = 0; + while (!cfManager.isMounted() && retryCount < 10) + { + Sleep(1000); + retryCount++; + } - if (!cfManager.isMounted()) + if (retryCount == 10) { return error(ErrorCode::internalError, "Cloudfuse was not able to successfully mount"); }