Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
21a8460
Improve HTTP response handling and retry logic
MichaelGHSeg Feb 12, 2026
e4f34d0
Increase max retries from 10 to 1000
MichaelGHSeg Feb 12, 2026
8bd4163
Update segment/analytics/test/test_request.py
MichaelGHSeg Feb 12, 2026
e1ac214
Apply suggestions from code review
MichaelGHSeg Feb 18, 2026
6a10b7c
Address PR review feedback
MichaelGHSeg Feb 19, 2026
6ed8ef6
Implement unified HTTP response handling per SDD
MichaelGHSeg Feb 25, 2026
a28102f
Fix Retry-After: 0 handling and 429 re-queue guard
MichaelGHSeg Feb 25, 2026
2165298
Merge branch 'master' into response-status-updates
MichaelGHSeg Feb 25, 2026
115d124
Address PR review: catch KeyError in response parsing
MichaelGHSeg Feb 25, 2026
2474b46
Enabling retry e2e test set
MichaelGHSeg Feb 25, 2026
98df1bc
Fix Retry-After header never parsed on non-2xx responses
MichaelGHSeg Feb 26, 2026
ec0481f
Wire on_error callback in e2e-cli for failure reporting
MichaelGHSeg Feb 26, 2026
ea257f8
Consolidate backoff parameters: max retries 1000 -> 10
MichaelGHSeg Mar 4, 2026
184fe1f
Merge branch 'master' into response-status-updates
MichaelGHSeg Mar 11, 2026
12d2f08
Omit X-Retry-Count header on first attempt, send only on retries
MichaelGHSeg Mar 20, 2026
a2fd03b
Treat 2xx and 3xx status codes as success, not just 200
MichaelGHSeg May 1, 2026
f0c39a7
Merge remote-tracking branch 'origin/master' into response-status-upd…
MichaelGHSeg May 7, 2026
8c5680a
Improve e2e-cli setup: Python resolution and devbox docs
MichaelGHSeg May 7, 2026
ad198ef
Address all issues from deep code review
MichaelGHSeg May 11, 2026
211f094
Refine documentation in flush method
MichaelGHSeg May 11, 2026
a1314f8
Delete status-response-updates-deep-review.md
MichaelGHSeg May 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
  • Loading branch information
MichaelGHSeg and Copilot authored Feb 18, 2026
commit e1ac2143dff29adcba581564f758c284038568ea
5 changes: 3 additions & 2 deletions segment/analytics/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import json
import base64
from dateutil.tz import tzutc
from requests.auth import HTTPBasicAuth

from requests import sessions

from segment.analytics.version import VERSION
Expand All @@ -30,7 +30,8 @@ def parse_retry_after(response):
try:
# Try parsing as integer (delay in seconds)
delay = int(retry_after)
return min(delay, MAX_RETRY_AFTER_SECONDS)
# Ensure delay is non-negative before applying upper bound
return min(max(delay, 0), MAX_RETRY_AFTER_SECONDS)
except ValueError:
# Could be HTTP-date format, but for simplicity we'll skip that
# Most APIs use integer seconds
Expand Down
4 changes: 1 addition & 3 deletions segment/analytics/test/test_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,10 +490,8 @@ def mock_post_fn(*args, **kwargs):
raise FatalError('Fatal error occurred')

with mock.patch('segment.analytics.consumer.post', side_effect=mock_post_fn):
try:
with self.assertRaises(FatalError):
consumer.request([track])
except FatalError:
pass

# Should only be called once (no retries)
self.assertEqual(call_count, 1)
Expand Down