зеркало из https://github.com/microsoft/vcpkg.git
[vcpkg] Increment number of retries and timeout of fs.rename() (#13931)
* Fix retry logic for fs.rename() * Increase timeout for fs.rename(), add diagnostic message * Make formatting happy * Exponential backoff for archive file rename * Remove random local file from last commit * Remove random local file from last commit * Update toolsrc/src/vcpkg/archives.cpp Co-authored-by: Mikayel Apozyan <Mikayel.Apozyan@avira.com> Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
This commit is contained in:
Родитель
e2ff466f65
Коммит
d22d77e3c5
|
@ -1,3 +1,4 @@
|
||||||
|
#include <vcpkg/base/system.print.h>
|
||||||
#include <vcpkg/base/system.process.h>
|
#include <vcpkg/base/system.process.h>
|
||||||
|
|
||||||
#include <vcpkg/archives.h>
|
#include <vcpkg/archives.h>
|
||||||
|
@ -97,12 +98,16 @@ namespace vcpkg::Archives
|
||||||
|
|
||||||
fs.rename(to_path_partial, to_path, ec);
|
fs.rename(to_path_partial, to_path, ec);
|
||||||
|
|
||||||
for (int i = 0; i < 5 && ec; i++)
|
|
||||||
{
|
|
||||||
i++;
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
std::this_thread::sleep_for(i * 100ms);
|
|
||||||
|
auto retry_delay = 8ms;
|
||||||
|
|
||||||
|
for (int i = 0; i < 10 && ec; i++)
|
||||||
|
{
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
std::this_thread::sleep_for(retry_delay);
|
||||||
fs.rename(to_path_partial, to_path, ec);
|
fs.rename(to_path_partial, to_path, ec);
|
||||||
|
retry_delay *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
Checks::check_exit(VCPKG_LINE_INFO,
|
Checks::check_exit(VCPKG_LINE_INFO,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче