Skip to content

Commit 7baf6a7

Browse files
silent api paths
1 parent 8e8e226 commit 7baf6a7

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/controllers/api_controller.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@
66
from config import API_BASE_URL
77

88

9+
SILENT_PATHS = frozenset(["/health", "/traffic-light"])
10+
11+
912
class ApiController:
1013
@staticmethod
1114
def _req(method, path, **kwargs):
1215
url = f"{API_BASE_URL}{path}"
1316
start = time.time()
1417
resp = requests.request(method, url, **kwargs)
1518
ms = (time.time() - start) * 1000
16-
logging.info(f"[CLIENT] {method.upper()} {url} -> {resp.status_code} ({ms:.0f}ms)")
19+
if path not in SILENT_PATHS:
20+
logging.info(f"[CLIENT] {method.upper()} {url} -> {resp.status_code} ({ms:.0f}ms)")
1721
return resp
1822

1923
@staticmethod

src/hardware/rfid_reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def __init__(self, usb_id):
1616
self._usb_id = usb_id
1717
self._pn532 = None
1818
self._pending_tag = None
19-
if not exists(usb_id):
19+
if not usb_id or not exists(usb_id):
2020
logging.error("Card reader not found at %s, exiting", usb_id)
2121
sys.exit(1)
2222
for attempt in range(1, 6):

0 commit comments

Comments
 (0)