-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Expected Behavior
Unknown HTTP status codes should also be retried. This is because they can sometimes be caused by things like TLS handshake timeouts which may be transient.
Current Behavior
Many records are failing to be sent to Amplitude in an AWS Lambda cold start situation because of errors such as this:
- The handshake operation timed out
- The write operation timed out
(Each with a -1 status code)
In theory these could be recoverable so we should try.
Possible Solution
One line code change:
--- a/src/amplitude/processor.py
+++ b/src/amplitude/processor.py
@@ -15,7 +15,7 @@ class ResponseProcessor:
if res.status == HttpStatus.SUCCESS:
self.callback(events, res.code, "Event sent successfully.")
self.log(events, res.code, "Event sent successfully.")
- elif res.status == HttpStatus.TIMEOUT or res.status == HttpStatus.FAILED:
+ elif res.status in (HttpStatus.TIMEOUT, HttpStatus.FAILED, HttpStatus.UNKNOWN):
self.push_to_storage(events, 0, res)
elif res.status == HttpStatus.PAYLOAD_TOO_LARGE:
if len(events) == 1:Steps to Reproduce
Environment
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working