From 28d165e32471636305c1da2bf1a3237a0e1c47d8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Mar 2026 19:52:38 +0000 Subject: [PATCH 1/2] Initial plan From 4b5fb50a57c686eb97d4307476d3ce218f89635d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Mar 2026 19:55:30 +0000 Subject: [PATCH 2/2] Replace busy-wait with std::this_thread::sleep_for in StorageAttachmentGuard::Wait Co-authored-by: anasdorbani <95044293+anasdorbani@users.noreply.github.com> --- _codeql_detected_source_root | 1 + src/core/config/config.cpp | 13 +++---------- 2 files changed, 4 insertions(+), 10 deletions(-) create mode 120000 _codeql_detected_source_root diff --git a/_codeql_detected_source_root b/_codeql_detected_source_root new file mode 120000 index 00000000..945c9b46 --- /dev/null +++ b/_codeql_detected_source_root @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/src/core/config/config.cpp b/src/core/config/config.cpp index 79b48b2e..9686ec86 100644 --- a/src/core/config/config.cpp +++ b/src/core/config/config.cpp @@ -2,6 +2,7 @@ #include "duckdb/common/file_system.hpp" #include "flock/secret_manager/secret_manager.hpp" #include +#include #include namespace flock { @@ -144,11 +145,7 @@ bool Config::StorageAttachmentGuard::TryDetach() { } void Config::StorageAttachmentGuard::Wait(int milliseconds) { - auto start = std::chrono::steady_clock::now(); - auto duration = std::chrono::milliseconds(milliseconds); - while (std::chrono::steady_clock::now() - start < duration) { - // Busy-wait until the specified duration has elapsed - } + std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds)); } Config::StorageAttachmentGuard::StorageAttachmentGuard(duckdb::Connection& con, bool read_only) @@ -201,11 +198,7 @@ bool Config::StorageAttachmentGuard::TryDetach() { } void Config::StorageAttachmentGuard::Wait(int milliseconds) { - auto start = std::chrono::steady_clock::now(); - auto duration = std::chrono::milliseconds(milliseconds); - while (std::chrono::steady_clock::now() - start < duration) { - // Busy-wait until the specified duration has elapsed - } + std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds)); } Config::StorageAttachmentGuard::StorageAttachmentGuard(duckdb::Connection& con, bool read_only)