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:
parent
f1c2bca901
commit
b9eadf9112
4
doors.py
4
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:
|
||||
|
|
Loading…
Reference in New Issue