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

Source Facebook Marketing: Add 80000 as a rate-limiting error code. #3996

Merged
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
Next Next commit
Fix typo in Facebook rate limit error code (should be 80000, not 8000).
  • Loading branch information
zestyping committed Jun 9, 2021
commit f3825bed3ed42f76911685744392f3702e9b1d67
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
from airbyte_cdk.entrypoint import logger # FIXME (Eugene K): register logger as standard python logger
from facebook_business.exceptions import FacebookRequestError

# The Facebook API error codes indicating rate-limiting are listed at
# https://developers.facebook.com/docs/graph-api/overview/rate-limiting/
FACEBOOK_RATE_LIMIT_ERROR_CODES = (4, 17, 32, 613, 8000, 80000, 80001, 80002, 80003, 80004, 80005, 80006, 80008)
FACEBOOK_UNKNOWN_ERROR_CODE = 99
FACEBOOK_API_CALL_LIMIT_ERROR_CODES = (4, 17, 32, 613, 8000, 80001, 80002, 80003, 80004, 80005, 80006, 80008)
DEFAULT_SLEEP_INTERVAL = pendulum.Interval(minutes=1)


Expand Down Expand Up @@ -80,7 +82,7 @@ def log_retry_attempt(details):

def should_retry_api_error(exc):
if isinstance(exc, FacebookRequestError):
if exc.api_error_code() in FACEBOOK_API_CALL_LIMIT_ERROR_CODES:
if exc.api_error_code() in FACEBOOK_RATE_LIMIT_ERROR_CODES:
return handle_call_rate_response(exc)
return exc.api_transient_error() or exc.api_error_subcode() == FACEBOOK_UNKNOWN_ERROR_CODE
return True
Expand Down