adds cleanup functionality for old devices
- device now last field 'last connection' which gets updated at every server connection from the respective device - manual cleanup script in database deletes all devices which have never been updated, or have a timestamp older than 30 days
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
# Python standard libraries
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
|
||||
# Third-party libraries
|
||||
import flask
|
||||
@ -204,6 +205,7 @@ def downloader(device):
|
||||
if request_device.user_id == None:
|
||||
return jsonify(kind="unregistered")
|
||||
|
||||
request_device.lastConnection=int(round(time.time()))
|
||||
request_device.connection=True
|
||||
db.session.commit()
|
||||
request_user = db.session.query(User).filter(User.id==request_device.user_id).first()
|
||||
|
Reference in New Issue
Block a user