mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
process CancelledError
This commit is contained in:
parent
445f2f9e63
commit
77a7498731
@ -574,6 +574,8 @@ class Server: # pylint: disable=too-many-instance-attributes
|
|||||||
logger.info("Cleaning up %s ...", type(obj).__name__)
|
logger.info("Cleaning up %s ...", type(obj).__name__)
|
||||||
try:
|
try:
|
||||||
await obj.cleanup() # type: ignore
|
await obj.cleanup() # type: ignore
|
||||||
|
except asyncio.CancelledError: # pylint: disable=try-except-raise
|
||||||
|
raise
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception("Cleanup error")
|
logger.exception("Cleanup error")
|
||||||
|
|
||||||
@ -605,6 +607,8 @@ class Server: # pylint: disable=too-many-instance-attributes
|
|||||||
remote: Optional[str] = (ws._req.remote if ws._req is not None else None) # pylint: disable=protected-access
|
remote: Optional[str] = (ws._req.remote if ws._req is not None else None) # pylint: disable=protected-access
|
||||||
get_logger().info("Removed client socket: remote=%s; id=%d; active=%d", remote, id(ws), len(self.__sockets))
|
get_logger().info("Removed client socket: remote=%s; id=%d; active=%d", remote, id(ws), len(self.__sockets))
|
||||||
await ws.close()
|
await ws.close()
|
||||||
|
except asyncio.CancelledError: # pylint: disable=try-except-raise
|
||||||
|
raise
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
@ -128,6 +128,8 @@ class Streamer: # pylint: disable=too-many-instance-attributes
|
|||||||
state = (await response.json())["result"]
|
state = (await response.json())["result"]
|
||||||
except (aiohttp.ClientConnectionError, aiohttp.ServerConnectionError):
|
except (aiohttp.ClientConnectionError, aiohttp.ServerConnectionError):
|
||||||
pass
|
pass
|
||||||
|
except asyncio.CancelledError: # pylint: disable=try-except-raise
|
||||||
|
raise
|
||||||
except Exception:
|
except Exception:
|
||||||
get_logger().exception("Invalid streamer response from /state")
|
get_logger().exception("Invalid streamer response from /state")
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -20,6 +20,8 @@
|
|||||||
# ========================================================================== #
|
# ========================================================================== #
|
||||||
|
|
||||||
|
|
||||||
|
import asyncio
|
||||||
|
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@ -86,6 +88,8 @@ class Plugin(BaseAuthService):
|
|||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
assert response.status == 200
|
assert response.status == 200
|
||||||
return True
|
return True
|
||||||
|
except asyncio.CancelledError: # pylint: disable=try-except-raise
|
||||||
|
raise
|
||||||
except Exception:
|
except Exception:
|
||||||
get_logger().exception("Failed HTTP auth request for user %r", user)
|
get_logger().exception("Failed HTTP auth request for user %r", user)
|
||||||
return False
|
return False
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user