Fix cleaner
This commit is contained in:
parent
3d59f949cf
commit
f67c6c0100
13
run.py
13
run.py
|
@ -31,6 +31,13 @@ log.setLevel(logging.ERROR)
|
||||||
|
|
||||||
def cleaner_thread():
|
def cleaner_thread():
|
||||||
print_log('Notice', 'Cleaner started')
|
print_log('Notice', 'Cleaner started')
|
||||||
|
|
||||||
|
# Call itself again after the interval
|
||||||
|
cleaner = Timer(config["CLEAN_INTERVAL"], cleaner_thread)
|
||||||
|
cleaner.daemon = True # Daemons will attempt to exit cleanly along with the main process, which we want
|
||||||
|
cleaner.start()
|
||||||
|
|
||||||
|
# Actual function
|
||||||
delete_old()
|
delete_old()
|
||||||
|
|
||||||
|
|
||||||
|
@ -169,13 +176,11 @@ def nginx_error(error):
|
||||||
return error_page(error="We literally have no idea what just happened", code="Unknown")
|
return error_page(error="We literally have no idea what just happened", code="Unknown")
|
||||||
|
|
||||||
|
|
||||||
cleaner = Timer(config["CLEAN_INTERVAL"], cleaner_thread)
|
|
||||||
cleaner.start()
|
cleaner_thread()
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(
|
app.run(
|
||||||
port=config["PORT"],
|
port=config["PORT"],
|
||||||
host=config["HOST"],
|
host=config["HOST"],
|
||||||
debug=config["DEBUG"]
|
debug=config["DEBUG"]
|
||||||
)
|
)
|
||||||
cleaner.cancel()
|
|
||||||
cleaner.join()
|
|
Loading…
Reference in New Issue