This commit is contained in:
grossmj committed 2019-11-11 12:44:31 +08:00
1 parent 2fd4b2cbc8
commit a98fc2d308
6 files changed
+10 -9

No files matched your search

@@ -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:
+1 -1
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)
+1 -3
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()
+5 -4
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})