1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 03:08:14 +00:00
This commit is contained in:
grossmj 2019-11-11 12:44:31 +08:00
parent 2fd4b2cbc8
commit a98fc2d308
6 changed files with 10 additions and 9 deletions

View File

@ -30,3 +30,4 @@ env:
- PYTHON_VERSION=3.5
- PYTHON_VERSION=3.6
- PYTHON_VERSION=3.7
- PYTHON_VERSION=3.8

View File

@ -193,7 +193,7 @@ class ProjectHandler:
msg = json.dumps({"action": action, "event": msg}, sort_keys=True)
log.debug("Send notification: %s", msg)
await response.write(("{}\n".format(msg)).encode("utf-8"))
except asyncio.futures.TimeoutError:
except asyncio.TimeoutError:
await response.write("{}\n".format(json.dumps(ProjectHandler._getPingMessage())).encode("utf-8"))
project.stop_listen_queue(queue)
if project.id in ProjectHandler._notifications_listening:

View File

@ -42,7 +42,7 @@ class NotificationQueue(asyncio.Queue):
try:
(action, msg, kwargs) = await asyncio.wait_for(super().get(), timeout)
except asyncio.futures.TimeoutError:
except asyncio.TimeoutError:
return ("ping", PingStats.get(), {})
return (action, msg, kwargs)

View File

@ -22,8 +22,6 @@ import sys
import os
import threading
from asyncio.futures import CancelledError
async def wait_run_in_executor(func, *args, **kwargs):
"""
@ -56,7 +54,7 @@ async def cancellable_wait_run_in_executor(func, *args, **kwargs):
kwargs['stopped_event'] = stopped_event
try:
await wait_run_in_executor(func, *args, **kwargs)
except CancelledError:
except asyncio.CancelledError:
stopped_event.set()

View File

@ -20,13 +20,10 @@ import json
import urllib
import asyncio
import aiohttp
import logging
import traceback
import jsonschema
import jsonschema.exceptions
log = logging.getLogger(__name__)
from ..compute.error import NodeError, ImageMissingError
from ..controller.controller_error import ControllerError
from ..ubridge.ubridge_error import UbridgeError
@ -36,6 +33,10 @@ from ..crash_report import CrashReport
from ..config import Config
import logging
log = logging.getLogger(__name__)
async def parse_request(request, input_schema, raw):
"""Parse body of request and raise HTTP errors in case of problems"""
@ -217,7 +218,7 @@ class Route(object):
response = Response(request=request, route=route)
response.set_status(409)
response.json({"message": str(e), "status": 409, "image": e.image, "exception": e.__class__.__name__})
except asyncio.futures.CancelledError:
except asyncio.CancelledError:
response = Response(request=request, route=route)
response.set_status(408)
response.json({"message": "Request canceled", "status": 408})

View File

@ -77,6 +77,7 @@ setup(
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: Implementation :: CPython",
],
)