diff options
| author | mapozyan <66947683+mapozyan@users.noreply.github.com> | 2020-11-25 20:28:04 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-25 11:28:04 -0800 |
| commit | d22d77e3c5ac70747645486699a61386b51a0333 (patch) | |
| tree | 99f523f9b74f156b8fe0fb9264a147adc72d1a45 | |
| parent | e2ff466f65a82dd31584468ddf67955092c79c11 (diff) | |
| download | vcpkg-d22d77e3c5ac70747645486699a61386b51a0333.tar.gz vcpkg-d22d77e3c5ac70747645486699a61386b51a0333.zip | |
[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>
| -rw-r--r-- | toolsrc/src/vcpkg/archives.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/toolsrc/src/vcpkg/archives.cpp b/toolsrc/src/vcpkg/archives.cpp index 4c97a7b5a..0faf756ad 100644 --- a/toolsrc/src/vcpkg/archives.cpp +++ b/toolsrc/src/vcpkg/archives.cpp @@ -1,3 +1,4 @@ +#include <vcpkg/base/system.print.h> #include <vcpkg/base/system.process.h> #include <vcpkg/archives.h> @@ -97,12 +98,16 @@ namespace vcpkg::Archives fs.rename(to_path_partial, to_path, ec); - for (int i = 0; i < 5 && ec; i++) + using namespace std::chrono_literals; + + auto retry_delay = 8ms; + + for (int i = 0; i < 10 && ec; i++) { - i++; using namespace std::chrono_literals; - std::this_thread::sleep_for(i * 100ms); + std::this_thread::sleep_for(retry_delay); fs.rename(to_path_partial, to_path, ec); + retry_delay *= 2; } Checks::check_exit(VCPKG_LINE_INFO, |
