aboutsummaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authoralexromanov <alexromanov@yandex-team.ru>2022-02-10 16:50:09 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:09 +0300
commit1862120cb626cb11ea2af213e3eea99e0c7f3dac (patch)
treeb325a32771001d8e7fbd6c9e25abed76daefcdfd /library
parentfb59c45ea90695dc011d56248f3e699e1eccc542 (diff)
downloadydb-1862120cb626cb11ea2af213e3eea99e0c7f3dac.tar.gz
Restoring authorship annotation for <alexromanov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library')
-rw-r--r--library/cpp/deprecated/ya.make2
-rw-r--r--library/cpp/retry/retry.cpp4
-rw-r--r--library/cpp/retry/retry.h24
3 files changed, 15 insertions, 15 deletions
diff --git a/library/cpp/deprecated/ya.make b/library/cpp/deprecated/ya.make
index 6c753f68a9..ce867c91ae 100644
--- a/library/cpp/deprecated/ya.make
+++ b/library/cpp/deprecated/ya.make
@@ -29,7 +29,7 @@ RECURSE(
omni/usage
omni/ut
prog_options
- prog_options/ut
+ prog_options/ut
sgi_hash
threadable
transgene
diff --git a/library/cpp/retry/retry.cpp b/library/cpp/retry/retry.cpp
index 92466cdeca..5ddfcecd62 100644
--- a/library/cpp/retry/retry.cpp
+++ b/library/cpp/retry/retry.cpp
@@ -11,8 +11,8 @@ bool DoWithRetryOnRetCode(std::function<bool()> func, TRetryOptions retryOptions
if (func()) {
return true;
}
- auto sleep = retryOptions.SleepFunction;
- sleep(retryOptions.GetTimeToSleep(attempt));
+ auto sleep = retryOptions.SleepFunction;
+ sleep(retryOptions.GetTimeToSleep(attempt));
}
return false;
}
diff --git a/library/cpp/retry/retry.h b/library/cpp/retry/retry.h
index c47ff5070f..b8297e9c52 100644
--- a/library/cpp/retry/retry.h
+++ b/library/cpp/retry/retry.h
@@ -19,17 +19,17 @@ struct TRetryOptions {
TDuration SleepIncrement;
TDuration SleepExponentialMultiplier;
- std::function<void(TDuration)> SleepFunction;
-
+ std::function<void(TDuration)> SleepFunction;
+
TRetryOptions(ui32 retryCount = 3, TDuration sleepDuration = TDuration::Seconds(1), TDuration sleepRandomDelta = TDuration::Zero(),
- TDuration sleepIncrement = TDuration::Zero(), TDuration sleepExponentialMultiplier = TDuration::Zero(),
- std::function<void(TDuration)> sleepFunction = [](TDuration d) { Sleep(d); }) // can't use Sleep itself due to Win compilation error
+ TDuration sleepIncrement = TDuration::Zero(), TDuration sleepExponentialMultiplier = TDuration::Zero(),
+ std::function<void(TDuration)> sleepFunction = [](TDuration d) { Sleep(d); }) // can't use Sleep itself due to Win compilation error
: RetryCount(retryCount)
, SleepDuration(sleepDuration)
, SleepRandomDelta(sleepRandomDelta)
, SleepIncrement(sleepIncrement)
, SleepExponentialMultiplier(sleepExponentialMultiplier)
- , SleepFunction(sleepFunction)
+ , SleepFunction(sleepFunction)
{
}
@@ -58,11 +58,11 @@ struct TRetryOptions {
return *this;
}
- TRetryOptions& WithSleepFunction(std::function<void(TDuration)> sleepFunction) {
- SleepFunction = sleepFunction;
- return *this;
- }
-
+ TRetryOptions& WithSleepFunction(std::function<void(TDuration)> sleepFunction) {
+ SleepFunction = sleepFunction;
+ return *this;
+ }
+
// for compatibility attempt == 0 by default
TDuration GetTimeToSleep(ui32 attempt = 0) const {
return SleepDuration + NRetryPrivate::AddRandomDelta(SleepRandomDelta) + NRetryPrivate::AddIncrement(attempt, SleepIncrement) + NRetryPrivate::AddExponentialMultiplier(attempt, SleepExponentialMultiplier);
@@ -93,8 +93,8 @@ TMaybe<TResult> DoWithRetry(std::function<TResult()> func, std::function<void(co
throw;
}
} else {
- auto sleep = retryOptions.SleepFunction;
- sleep(retryOptions.GetTimeToSleep(attempt));
+ auto sleep = retryOptions.SleepFunction;
+ sleep(retryOptions.GetTimeToSleep(attempt));
}
}
}