diff options
author | Alexey Salmin <alexey.salmin@gmail.com> | 2022-02-10 16:49:37 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:37 +0300 |
commit | 71af077a5dfe7e9f932a508422c2dac81a57ebc0 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/retry/retry.cpp | |
parent | 3c5b1607b38f637d2f3313791ed25c2e080d2647 (diff) | |
download | ydb-71af077a5dfe7e9f932a508422c2dac81a57ebc0.tar.gz |
Restoring authorship annotation for Alexey Salmin <alexey.salmin@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/retry/retry.cpp')
-rw-r--r-- | library/cpp/retry/retry.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/library/cpp/retry/retry.cpp b/library/cpp/retry/retry.cpp index eb589832eb..92466cdeca 100644 --- a/library/cpp/retry/retry.cpp +++ b/library/cpp/retry/retry.cpp @@ -5,17 +5,17 @@ void DoWithRetry(std::function<void()> func, TRetryOptions retryOptions) { DoWithRetry(func, retryOptions, true); } - -bool DoWithRetryOnRetCode(std::function<bool()> func, TRetryOptions retryOptions) { - for (ui32 attempt = 0; attempt <= retryOptions.RetryCount; ++attempt) { - if (func()) { - return true; - } + +bool DoWithRetryOnRetCode(std::function<bool()> func, TRetryOptions retryOptions) { + for (ui32 attempt = 0; attempt <= retryOptions.RetryCount; ++attempt) { + if (func()) { + return true; + } auto sleep = retryOptions.SleepFunction; sleep(retryOptions.GetTimeToSleep(attempt)); - } - return false; -} + } + return false; +} TRetryOptions MakeRetryOptions(const NRetry::TRetryOptionsPB& retryOptions) { return TRetryOptions(retryOptions.GetMaxTries(), |