mirror of
https://github.com/MathiasDPX/grainParisArt.git
synced 2025-01-08 16:16:40 +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 flask import Flask, render_template, request
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
from threading import Thread
|
||||||
from os import getenv
|
from os import getenv
|
||||||
import monitoring
|
import monitoring
|
||||||
import html
|
import html
|
||||||
|
@ -86,11 +87,11 @@ def home():
|
||||||
if delta > 6: delta = 6
|
if delta > 6: delta = 6
|
||||||
if delta < 0: delta = 0
|
if delta < 0: delta = 0
|
||||||
|
|
||||||
monitoring.log(
|
Thread(target=monitoring.log, kwargs={
|
||||||
ip=request.environ.get("HTTP_X_FORWARDED_FOR", request.remote_addr),
|
'ip': request.environ.get("HTTP_X_FORWARDED_FOR", request.remote_addr),
|
||||||
useragent=request.headers.get('User-Agent'),
|
'useragent': request.headers.get('User-Agent'),
|
||||||
day=delta
|
'day': delta
|
||||||
)
|
}).start()
|
||||||
|
|
||||||
dates = []
|
dates = []
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue