Skip to content

fix: add check to drop events that return a 400 response from Segment #296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 13, 2024
Merged
Changes from 1 commit
Commits
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
7 changes: 7 additions & 0 deletions Sources/Segment/Plugins/SegmentDestination.swift
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ public class SegmentDestination: DestinationPlugin, Subscriber, FlushCompletion
case .success(_):
storage.remove(file: url)
self.cleanupUploads()

// we don't want to retry events in a given batch when a 400
// response for malformed JSON is returned
case .failure(Segment.HTTPClientErrors.statusCode(code: 400)):
analytics.log(message: "Server returned a 400 response: malformed JSON")
storage.remove(file: url)
self.cleanupUploads()
default:
break
}
Expand Down