From 22fd4f94d810c3c3453cc2034e4360644e991c79 Mon Sep 17 00:00:00 2001 From: Aleksandr Denisyuk Date: Mon, 24 Jan 2022 17:05:11 +0300 Subject: [PATCH] Add NullBackOff --- docs/index.md | 14 ++++++++++++++ src/NullBackOff.php | 20 ++++++++++++++++++++ tests/NullBackOffTest.php | 22 ++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 src/NullBackOff.php create mode 100644 tests/NullBackOffTest.php diff --git a/docs/index.md b/docs/index.md index 13ead24..7d04bab 100644 --- a/docs/index.md +++ b/docs/index.md @@ -159,6 +159,7 @@ The following back-off decorators are available: - [ExponentialBackOff](../src/ExponentialBackOff.php) - [DecorrelatedBackOff](../src/DecorrelatedBackOff.php) - [ImmediatelyThrowableBackOff](../src/ImmediatelyThrowableBackOff.php) +- [NullBackOff](../src/NullBackOff.php) ## Retry exceptions @@ -168,6 +169,7 @@ Configure BackOff and ExceptionClassifier to retry your business logic when an e $this->maxAttempts) { + throw $throwable; + } + } +} diff --git a/tests/NullBackOffTest.php b/tests/NullBackOffTest.php new file mode 100644 index 0000000..73f807b --- /dev/null +++ b/tests/NullBackOffTest.php @@ -0,0 +1,22 @@ +expectExceptionObject($throwable); + + $nullBackOff->backOff(4, $throwable); + } +}