Skip to content

Commit

Permalink
Add TODO and better not registered handling
Browse files Browse the repository at this point in the history
  • Loading branch information
UsualSpec committed Jul 18, 2024
1 parent c9c1b3d commit 5b5a6fc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/management/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def deviceManagementPage(deviceUid):
def getDeviceStatus(deviceUid):
# Request measurement status of this device
if not deviceIsRegistered(deviceUid):
return json.dumps({"status": "Not registered"}), 422 # only if client is not even on the server side --> say not registered
return {"status": "Not registered"}, 422 # only if client is not even on the server side --> say not registered

statusRq = pbdef.api__pb2.mgmtRequest()
statusRq.msgType = pbdef.api__pb2.srvRequestType.REQUEST_MEASUREMENT_STATUS
Expand All @@ -199,9 +199,11 @@ def getAllDeviceStatus():
pgConnection.commit()
res = {}
for client in pgcurs:
# TODO: Speed this up e.g. by implementing a gRPC call directly to get all status messages from each device. This can wait a long time on timeouts
res[client[0]] = getDeviceStatus(client[0])

return json.dumps(res)
return res

@app.route("/getLastMeasurementTimestampOfDevicePost", methods=["POST"])
def getLastMeasurementTimestampOfDevicePost():
# Get the last timestamp from device
Expand Down

0 comments on commit 5b5a6fc

Please sign in to comment.