Skip to content

Commit

Permalink
variable TimeOut
Browse files Browse the repository at this point in the history
  • Loading branch information
rogelioLpz committed Feb 13, 2020
1 parent 3c13e4a commit 864dca1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion hub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
init_workers,
)

logging.basicConfig(level=logging.INFO, format='Hub: %(message)s')
logging.basicConfig(level=logging.INFO, format='%(message)s')
8 changes: 7 additions & 1 deletion hub/kinesis/producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
import uuid
from typing import Dict

from coverage.annotate import os

from hub.client import kinesis_client as client
from hub.kinesis.helpers import create_stream, dict_to_json, stream_is_active

KINESIS_TIME_OUT = int(os.getenv('KINESIS_TIME_OUT', '5'))


class Producer:
def __init__(self, stream_name: str):
Expand Down Expand Up @@ -70,7 +74,9 @@ def wait_for_data(self, uid: str, datetime_insert: dt.datetime) -> Dict:
except client.exceptions.ProvisionedThroughputExceededException:
time.sleep(1)

if (dt.datetime.utcnow() - start_time).total_seconds() >= 15:
if (
dt.datetime.utcnow() - start_time
).total_seconds() >= KINESIS_TIME_OUT:
raise TimeoutError

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion hub/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.0.20'
__version__ = '1.0.21'

0 comments on commit 864dca1

Please sign in to comment.