Skip to content

Commit 4ce37f7

Browse files
committed
Add retry backoff max and jitter settings [RHELDST-32465]
Previously these paramters used for urllib3's Retry were unset. Backoff max defaulted to 120, which was too low for Akamai's strict rate limiting. Jitter was also added to better spread requests, improve system stability.
1 parent d5827bf commit 4ce37f7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fastpurge/_client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ class FastPurgeClient(object):
106106
MAX_RETRIES = int(os.environ.get("FAST_PURGE_MAX_RETRIES", "10"))
107107

108108
RETRY_BACKOFF = float(os.environ.get("FAST_PURGE_RETRY_BACKOFF", "0.15"))
109+
RETRY_BACKOFF_MAX = float(os.environ.get("FAST_PURGE_RETRY_BACKOFF_MAX", "150"))
110+
RETRY_BACKOFF_JITTER = float(os.environ.get("FAST_PURGE_RETRY_JITTER", "2"))
111+
109112
# Default purge type.
110113
# Akamai recommend "invalidate", so why is "delete" our default?
111114
# Here's what Akamai docs have to say:
@@ -235,6 +238,8 @@ def __retry_policy(self):
235238
retries = LoggingRetry(
236239
total=self.MAX_RETRIES,
237240
backoff_factor=self.RETRY_BACKOFF,
241+
backoff_max=self.RETRY_BACKOFF_MAX,
242+
backoff_jitter=self.RETRY_BACKOFF_JITTER,
238243
# We strictly require 201 here since that's how the server
239244
# tells us we queued something async, as expected
240245
status_forcelist=[status.value for status in HTTPStatus

0 commit comments

Comments
 (0)