diff --git a/consumer_api/app.py b/consumer_api/app.py index dbedea3..3f5282f 100644 --- a/consumer_api/app.py +++ b/consumer_api/app.py @@ -19,6 +19,8 @@ sentry_sdk.init("https://0a106e104e114bc9a3fa47f9cb0db2f4@sentry.kmlabz.com/10") app = Flask(__name__) app.config['REDIS_URL'] = os.environ['REDIS_URL'] app.config['LOCAL_UUID'] = os.environ['LOCAL_UUID'] +app.config['CUSTOMER_TIMEOUT'] = int(os.environ.get('CUSTOMER_TIMEOUT', 30)) +app.config['PRODUCER_TIMEOUT'] = int(os.environ.get('PRODUCER_TIMEOUT', 60)) redis_client.init_app(app) diff --git a/consumer_api/views/log_view.py b/consumer_api/views/log_view.py index d2a4d15..2ebf4ff 100644 --- a/consumer_api/views/log_view.py +++ b/consumer_api/views/log_view.py @@ -23,7 +23,7 @@ class LogView(FlaskView): # update expirity redis_client.set(prod_key, remote_ip.encode('utf-8')) - redis_client.expire(prod_key, 240) + redis_client.expire(prod_key, current_app.config["PRODUCER_TIMEOUT"]) # print out message current_app.logger.info(f"New message: {request.json['message']}") diff --git a/consumer_api/views/sync_view.py b/consumer_api/views/sync_view.py index 1b034f1..071da44 100644 --- a/consumer_api/views/sync_view.py +++ b/consumer_api/views/sync_view.py @@ -29,7 +29,7 @@ class SyncView(FlaskView): } redis_client.set(cust_key, json.dumps(info).encode('utf-8')) - redis_client.expire(cust_key, 30) + redis_client.expire(cust_key, current_app.config["CUSTOMER_TIMEOUT"]) response = { "uuid": current_app.config['LOCAL_UUID']