Skip to content

Commit

Permalink
Merge pull request #4 from hotgluexyz/fix/retries
Browse files Browse the repository at this point in the history
Fix/retries
  • Loading branch information
hsyyid authored Feb 5, 2022
2 parents bb6a12d + f2ccf58 commit d55d533
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name="tap-shopify",
version="1.4.4",
version="1.4.5",
description="Singer.io tap for extracting Shopify data",
author="Stitch",
url="http://github.com/singer-io/tap-shopify",
Expand Down
12 changes: 5 additions & 7 deletions tap_shopify/streams/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
DATE_WINDOW_SIZE = 1

# We will retry a 500 error a maximum of 5 times before giving up
MAX_RETRIES = 5
MAX_RETRIES = 10

def is_not_status_code_fn(status_code):
def gen_fn(exc):
Expand All @@ -35,7 +35,7 @@ def leaky_bucket_handler(details):
details['wait'])

def retry_handler(details):
LOGGER.info("Received 500 or retryable error -- Retry %s/%s",
LOGGER.info("Received 500 or retryable -- Retry %s/%s",
details['tries'], MAX_RETRIES)

#pylint: disable=unused-argument
Expand All @@ -54,16 +54,14 @@ def shopify_error_handling(fnc):
@backoff.on_exception(backoff.expo,
(pyactiveresource.connection.ServerError,
pyactiveresource.formats.Error,
simplejson.scanner.JSONDecodeError),
giveup=is_not_status_code_fn(range(500, 599)),
simplejson.scanner.JSONDecodeError,
Exception),
on_backoff=retry_handler,
max_tries=MAX_RETRIES)
@backoff.on_exception(retry_after_wait_gen,
pyactiveresource.connection.ClientError,
giveup=is_not_status_code_fn([429]),
on_backoff=leaky_bucket_handler,
# No jitter as we want a constant value
jitter=None)
on_backoff=leaky_bucket_handler)
@functools.wraps(fnc)
def wrapper(*args, **kwargs):
return fnc(*args, **kwargs)
Expand Down

0 comments on commit d55d533

Please sign in to comment.