mirror of
https://github.com/MathiasDPX/grainParisArt.git
synced 2025-01-08 00:06:38 +00:00
Move log function to async
This commit is contained in:
parent
2dc1da3ec2
commit
cd023253ea
1 changed files with 6 additions and 5 deletions
11
app.py
11
app.py
|
@ -1,6 +1,7 @@
|
|||
from flask import Flask, render_template, request
|
||||
from datetime import timedelta
|
||||
from dotenv import load_dotenv
|
||||
from threading import Thread
|
||||
from os import getenv
|
||||
import monitoring
|
||||
import html
|
||||
|
@ -86,11 +87,11 @@ def home():
|
|||
if delta > 6: delta = 6
|
||||
if delta < 0: delta = 0
|
||||
|
||||
monitoring.log(
|
||||
ip=request.environ.get("HTTP_X_FORWARDED_FOR", request.remote_addr),
|
||||
useragent=request.headers.get('User-Agent'),
|
||||
day=delta
|
||||
)
|
||||
Thread(target=monitoring.log, kwargs={
|
||||
'ip': request.environ.get("HTTP_X_FORWARDED_FOR", request.remote_addr),
|
||||
'useragent': request.headers.get('User-Agent'),
|
||||
'day': delta
|
||||
}).start()
|
||||
|
||||
dates = []
|
||||
|
||||
|
|
Loading…
Reference in a new issue