Skip to content
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

Fix unhandled status responses resulting in bad requests being sent repeatedly #320

Merged
merged 1 commit into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ - (void)recordPostReply:(nullable RollbarPayloadPostReply *)reply
}

switch (reply.statusCode) {
case 401: // unauthorized
case 403: // access denied
case 404: // not found
RBLog(@"\tQueuing record");
//let's hold on on posting to the destination for 1 minute:
// let's hold on on posting to the destination for 1 minute:
self->_nextEarliestPost = [NSDate dateWithTimeIntervalSinceNow:60];
self->_localWindowCount = 0;
self->_serverWindowRemainingCount = 0;
Expand All @@ -113,7 +114,7 @@ - (void)recordPostReply:(nullable RollbarPayloadPostReply *)reply
case 422: // unprocessable entity
default:
RBLog(@"\tDropping record");
self->_nextServerWindowStart = [NSDate dateWithTimeIntervalSinceNow:reply.remainingSeconds];;
self->_nextServerWindowStart = [NSDate dateWithTimeIntervalSinceNow:reply.remainingSeconds];
self->_serverWindowRemainingCount = reply.remainingCount;
if (self->_nextLocalWindowStart) {
self->_localWindowCount = 0;
Expand Down
16 changes: 9 additions & 7 deletions RollbarNotifier/Sources/RollbarNotifier/RollbarThread.m
Original file line number Diff line number Diff line change
Expand Up @@ -553,10 +553,10 @@ - (RollbarTriStateFlag)sendPayload:(nonnull NSData *)payload
switch (reply.statusCode) {
case 200: // OK
return RollbarTriStateFlag_On; // the payload was successfully transmitted
case 400: // bad request
case 413: // request entity too large
case 422: // unprocessable entity
return RollbarTriStateFlag_Off; // unecceptable request/payload - should be dropped
case 401: // unauthorized
case 403: // access denied
case 404: // not found
return RollbarTriStateFlag_None; // worth retrying later
case 429: // too many requests
switch (self.rateLimitBehavior) {
case RollbarRateLimitBehavior_Queue:
Expand All @@ -565,10 +565,12 @@ - (RollbarTriStateFlag)sendPayload:(nonnull NSData *)payload
default:
return RollbarTriStateFlag_Off;
}
case 403: // access denied
case 404: // not found
case 400: // bad request
case 413: // request entity too large
case 422: // unprocessable entity
default:
return RollbarTriStateFlag_None; // worth retrying later
return RollbarTriStateFlag_Off; // unacceptable request/payload - should be dropped

}
}

Expand Down