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 <Anna.Schumaker@Netapp.com>
This commit is contained in:
Anna Schumaker 2016-01-13 14:19:27 -05:00
parent f1c2bca901
commit b9eadf9112
1 changed files with 2 additions and 2 deletions

View File

@ -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: