From b9eadf9112d5a04c89caf4a6810f0d7c98aad416 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Wed, 13 Jan 2016 14:19:27 -0500 Subject: [PATCH] Don't flood the server with key pings Rather than processing the entire list at once, handle each key one at a time to give priority to incoming scans. Signed-off-by: Anna Schumaker --- doors.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doors.py b/doors.py index 30b6a8d..3a3f7a6 100755 --- a/doors.py +++ b/doors.py @@ -140,7 +140,7 @@ def verify_key(key): lock_door() def ping_keys(): - while len(NEED_PING) > 0: + if len(NEED_PING) > 0: ping_server(NEED_PING[0]) NEED_PING.pop(0) @@ -164,8 +164,8 @@ def _do_read_rfid(): key = string[1:11].decode() #exclude start x0A and stop x0D bytes print("Read key: %s" % key) verify_key(key) - ping_keys() RFID_SERIAL.flushInput() # ignore errors, no data + ping_keys() def read_rfid(): try: