Skip to content

Commit 9ebb128

Browse files
author
John Miller
committed
adds backoff to utils
1 parent c9d2ff6 commit 9ebb128

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
'pendulum==1.2.0',
1515
'simplejson==3.11.1',
1616
'python-dateutil==2.6.0',
17+
'backoff==1.3.2',
1718
],
1819
packages=find_packages(),
1920
package_data = {

singer/utils.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import time
77
import dateutil
88
import pytz
9+
import backoff
910

1011
from singer.catalog import Catalog
1112

@@ -139,3 +140,12 @@ def check_config(config, required_keys):
139140
missing_keys = [key for key in required_keys if key not in config]
140141
if missing_keys:
141142
raise Exception("Config is missing required keys: {}".format(missing_keys))
143+
144+
145+
def backoff(exceptions, giveup):
146+
return backoff.on_exception(
147+
backoff.expo,
148+
exceptions,
149+
max_tries=5,
150+
giveup=giveup,
151+
factor=2)

0 commit comments

Comments
 (0)