From 4fe69da565f0cd360f36210d13b5acd57b286155 Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Mon, 11 Sep 2023 09:24:03 -0700 Subject: [PATCH] Add option to disable order logging --- .env-sample | 7 ++++++- api/models/order.py | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.env-sample b/.env-sample index 82d53c77..574c891b 100644 --- a/.env-sample +++ b/.env-sample @@ -101,7 +101,12 @@ PENALTY_TIMEOUT = 60 # Time between routing attempts of buyer invoice in MINUTES RETRY_TIME = 1 -# Platform activity limits +# Store Order Logs in DB. Verbose logging for each order as property of the order object in DB. Useful for debugging and for learning +# the order flow for new robosats coordinators (prints a pretty timestamped table on the coordinator panel on each order). But a bit heavy +# on write operations and can potentially affect performance for every request. +DISABLE_ORDER_LOGS = False + +# Coordinator activity limits MAX_PUBLIC_ORDERS = 100 # Trade limits in satoshis diff --git a/api/models/order.py b/api/models/order.py index 836cb60e..109f3377 100644 --- a/api/models/order.py +++ b/api/models/order.py @@ -287,6 +287,8 @@ class Order(models.Model): try/catch block since this function is called inside the main request->response pipe and any error here would lead to a 500 response. """ + if config("DISABLE_ORDER_LOGS", cast=bool, default=True): + return try: timestamp = timezone.now().replace(microsecond=0).isoformat() level_in_tag = "" if level == "INFO" else ""