Variable rename
This commit is contained in:
@@ -4,7 +4,7 @@ import threading
|
||||
|
||||
import paho.mqtt.subscribe as mqtt
|
||||
|
||||
database_file = "clients.json"
|
||||
database_filename = "clients.json"
|
||||
database_lock = threading.Lock()
|
||||
|
||||
# noinspection PyUnusedLocal
|
||||
@@ -12,11 +12,11 @@ def update_client_record(client, userdata, message):
|
||||
|
||||
database_lock.acquire()
|
||||
|
||||
if not os.path.exists(database_file):
|
||||
with open(database_file, 'w') as database_blank:
|
||||
if not os.path.exists(database_filename):
|
||||
with open(database_filename, 'w') as database_blank:
|
||||
json.dump({}, database_blank)
|
||||
|
||||
with open(database_file, 'r') as infile:
|
||||
with open(database_filename, 'r') as infile:
|
||||
database = json.load(infile)
|
||||
|
||||
payload = message.payload.decode('utf-8')
|
||||
@@ -24,7 +24,7 @@ def update_client_record(client, userdata, message):
|
||||
|
||||
database[response['clientId']] = response
|
||||
|
||||
with open(database_file, 'w') as outfile:
|
||||
with open(database_filename, 'w') as outfile:
|
||||
json.dump(database, outfile)
|
||||
|
||||
database_lock.release()
|
||||
|
||||
Reference in New Issue
Block a user