aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/linklogger.py20
-rw-r--r--requirements.txt5
2 files changed, 17 insertions, 8 deletions
diff --git a/app/linklogger.py b/app/linklogger.py
index 035835e..640cff6 100644
--- a/app/linklogger.py
+++ b/app/linklogger.py
@@ -1,11 +1,19 @@
from routes import app
from db import init_db
-from hypercorn.config import Config
-from hypercorn.asyncio import serve
-import asyncio
+import waitress
+import threading
+import schedule
+import time
+
+from func.remove_old_data import remove_old_data
if __name__ == '__main__':
init_db()
- config = Config()
- config.bind =["0.0.0.0:5252"]
- asyncio.run(serve(app, config)) \ No newline at end of file
+ thread = threading.Thread(target=waitress.serve, args=(app,), kwargs={'port': 5252})
+ thread.start()
+ print('Server running on port 5252. Healthy.')
+
+ schedule.every().day.at('00:01').do(remove_old_data)
+ while True:
+ schedule.run_pending()
+ time.sleep(1) \ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
index 270da36..11fa0ed 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,9 +1,10 @@
Flask==3.0.0
Flask-HTTPAuth==4.8.0
-Hypercorn==0.15.0
+waitress==2.1.2
ip2location-io==1.0.0
python-dotenv==1.0.0
SQLAlchemy==2.0.27
tabulate==0.9.0
ua-parser==0.18.0
-validators==0.22.0 \ No newline at end of file
+validators==0.22.0
+schedule==1.2.1 \ No newline at end of file