Skip to content

Commit

Permalink
fix(integration): Fix rate limit handling (#2686)
Browse files Browse the repository at this point in the history
## Context

This PR follows #2570

## Description

It updates the way we check for the presence of the rate error limit
code in the payload to avoid parsing the JSON body and be independent
from the format of the response.
  • Loading branch information
vincent-pochet authored Oct 14, 2024
1 parent 3b1fd64 commit 5a03fd7
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions app/services/integrations/aggregator/base_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,7 @@ def message(error)
def request_limit_error?(http_error)
return false unless http_error.error_code.to_i == 500

http_error.json_message.dig('error', 'payload', 'error', 'code') == REQUEST_LIMIT_ERROR_CODE
rescue JSON::ParserError
false
http_error.error_body.include?(REQUEST_LIMIT_ERROR_CODE)
end
end
end
Expand Down

0 comments on commit 5a03fd7

Please sign in to comment.