Merge pull request #24 from YunoHost/bullseye

Bullseye
This commit is contained in:
yalh76 2021-08-27 19:15:10 +02:00 committed by GitHub
commit 58dafe2e08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 7 deletions

View file

@ -20,6 +20,6 @@ sanic-routing==0.6.2
typing-extensions==3.10.0.0 typing-extensions==3.10.0.0
ujson==4.0.2 ujson==4.0.2
urllib3==1.26.5 urllib3==1.26.5
uvloop==0.11.3 uvloop==0.14.0
websockets==8.1 websockets==8.1
yarl==1.3.0 yarl==1.3.0

View file

@ -7,4 +7,4 @@ websockets
# cli # cli
argh argh
requests requests

14
run.py
View file

@ -40,6 +40,11 @@ from playhouse.shortcuts import model_to_dict
from models import Repo, Job, db, Worker from models import Repo, Job, db, Worker
from schedule import always_relaunch, once_per_day from schedule import always_relaunch, once_per_day
try:
asyncio_all_tasks = asyncio.all_tasks
except AttributeError as e:
asyncio_all_tasks = asyncio.Task.all_tasks
LOGGING_CONFIG_DEFAULTS["loggers"] = { LOGGING_CONFIG_DEFAULTS["loggers"] = {
"task": { "task": {
"level": "INFO", "level": "INFO",
@ -110,8 +115,7 @@ def datetime_to_epoch_json_converter(o):
return o.strftime('%s') return o.strftime('%s')
@asyncio.coroutine async def wait_closed(self):
def wait_closed(self):
""" """
Wait until the connection is closed. Wait until the connection is closed.
@ -121,7 +125,7 @@ def wait_closed(self):
of its cause, in tasks that interact with the WebSocket connection. of its cause, in tasks that interact with the WebSocket connection.
""" """
yield from asyncio.shield(self.connection_lost_waiter) await asyncio.shield(self.connection_lost_waiter)
# this is a backport of websockets 7.0 which sanic doesn't support yet # this is a backport of websockets 7.0 which sanic doesn't support yet
@ -971,7 +975,7 @@ async def html_index(request):
@always_relaunch(sleep=2) @always_relaunch(sleep=2)
async def number_of_tasks(): async def number_of_tasks():
print("Number of tasks: %s" % len(Task.all_tasks())) print("Number of tasks: %s" % len(asyncio_all_tasks()))
@app.route('/monitor') @app.route('/monitor')
@ -979,7 +983,7 @@ async def monitor(request):
snapshot = tracemalloc.take_snapshot() snapshot = tracemalloc.take_snapshot()
top_stats = snapshot.statistics('lineno') top_stats = snapshot.statistics('lineno')
tasks = Task.all_tasks() tasks = asyncio_all_tasks()
return response.json({ return response.json({
"top_20_trace": [str(x) for x in top_stats[:20]], "top_20_trace": [str(x) for x in top_stats[:20]],