-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add retry logic with exponential backoff #3
Copy link
Copy link
Open
Description
Summary
Add configurable retry logic with exponential backoff for transient failures.
Motivation
- Network issues can cause temporary connection failures
- ICAP servers may be temporarily unavailable during updates/restarts
- Production environments need resilience against transient errors
Proposed Implementation
- Add
retriesandbackoff_factorparameters toIcapClient - Retry on
IcapConnectionErrorandIcapTimeoutError - Use exponential backoff:
delay = backoff_factor * (2 ** attempt) - Make retry behavior configurable (max retries, which exceptions to retry)
Example Usage
from pycap import IcapClient
# Retry up to 3 times with exponential backoff
client = IcapClient(
'localhost',
retries=3,
backoff_factor=0.5 # 0.5s, 1s, 2s delays
)
with client:
response = client.scan_file('/path/to/file.pdf')Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels