From f46845ac2d4c761a86236d7c28411c46490437d8 Mon Sep 17 00:00:00 2001 From: Michael Haas Date: Fri, 17 Jun 2022 09:45:47 +0200 Subject: [PATCH] Improve resilience by tweaking retry configuration With the previous settings of `backoff_factor = 0.03` and `NUM_REQUEST_RETRIES = 5`, we would give the DAR service only around 5 seconds to recover. By changing to `backoff_factor = 0.05` and ``NUM_REQUEST_RETRIES = 5`, we end up retrying over a period of around 30s. --- CHANGELOG.md | 5 ++++- sap/aibus/dar/client/util/http_transport.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46e63c8..c123a30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,8 +17,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 because the special error response object will have a value of `None` for the `labels` key. As this project is still versioned below 1.0.0, the breaking API change does not warrant a major version update. See [#128] for details. +* Improve reliability by tweaking retry configuration [#129] [#128]: https://github.com/SAP/data-attribute-recommendation-python-sdk/pull/128 +[#129]: https://github.com/SAP/data-attribute-recommendation-python-sdk/pull/129 ## [0.11.0] @@ -266,7 +268,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * First public release -[Unreleased]: https://github.com/SAP/data-attribute-recommendation-python-sdk/compare/rel/0.10.0...HEAD +[Unreleased]: https://github.com/SAP/data-attribute-recommendation-python-sdk/compare/rel/0.12.0...HEAD +[0.11.0]: https://github.com/SAP/data-attribute-recommendation-python-sdk/compare/rel/0.11.0...rel/0.12.0 [0.11.0]: https://github.com/SAP/data-attribute-recommendation-python-sdk/compare/rel/0.10.0...rel/0.11.0 [0.10.0]: https://github.com/SAP/data-attribute-recommendation-python-sdk/compare/rel/0.9.2...rel/0.10.0 [0.9.2]: https://github.com/SAP/data-attribute-recommendation-python-sdk/compare/rel/0.9.1...rel/0.9.2 diff --git a/sap/aibus/dar/client/util/http_transport.py b/sap/aibus/dar/client/util/http_transport.py index 124885e..05aede2 100644 --- a/sap/aibus/dar/client/util/http_transport.py +++ b/sap/aibus/dar/client/util/http_transport.py @@ -19,7 +19,7 @@ CONNECT_TIMEOUT = 240 -NUM_REQUEST_RETRIES = 5 # total number of request retries +NUM_REQUEST_RETRIES = 7 # total number of request retries class HttpMethodsProtocol(Protocol): @@ -162,7 +162,7 @@ def __init__( self, num_retries: int, session: Session = None, - backoff_factor: float = 0.03, + backoff_factor: float = 0.05, status_forcelist: Tuple = (413, 429, 500, 502, 503, 504), ): """