mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 09:10:30 +08:00
asyncio.CancelledError is a subclass of BaseException since 3.8
This commit is contained in:
parent
5b58af4d6f
commit
966267ebb9
@ -178,8 +178,6 @@ async def run_region_task(
|
|||||||
async with region:
|
async with region:
|
||||||
entered.set_result(None)
|
entered.set_result(None)
|
||||||
await method(*args, **kwargs)
|
await method(*args, **kwargs)
|
||||||
except asyncio.CancelledError: # pylint: disable=try-except-raise
|
|
||||||
raise
|
|
||||||
except region.get_exc_type():
|
except region.get_exc_type():
|
||||||
raise
|
raise
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
@ -397,8 +397,6 @@ class KvmdServer(HttpServer): # pylint: disable=too-many-arguments,too-many-ins
|
|||||||
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
|
||||||
await self.__streamer_notifier.notify()
|
await self.__streamer_notifier.notify()
|
||||||
|
|||||||
@ -187,8 +187,6 @@ 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,8 +20,6 @@
|
|||||||
# ========================================================================== #
|
# ========================================================================== #
|
||||||
|
|
||||||
|
|
||||||
import asyncio
|
|
||||||
|
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
@ -92,8 +90,6 @@ 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
|
||||||
|
|||||||
@ -237,8 +237,6 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
|
|||||||
self.__drive.set_image_path("")
|
self.__drive.set_image_path("")
|
||||||
self.__drive.set_rw_flag(False)
|
self.__drive.set_rw_flag(False)
|
||||||
self.__drive.set_cdrom_flag(False)
|
self.__drive.set_cdrom_flag(False)
|
||||||
except asyncio.CancelledError: # pylint: disable=try-except-raise
|
|
||||||
raise
|
|
||||||
except Exception:
|
except Exception:
|
||||||
get_logger(0).exception("Can't reset MSD")
|
get_logger(0).exception("Can't reset MSD")
|
||||||
|
|
||||||
@ -332,8 +330,6 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
|
|||||||
await self.__close_new_file()
|
await self.__close_new_file()
|
||||||
try:
|
try:
|
||||||
await self.__remount_storage(rw=False)
|
await self.__remount_storage(rw=False)
|
||||||
except asyncio.CancelledError: # pylint: disable=try-except-raise
|
|
||||||
raise
|
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
finally:
|
finally:
|
||||||
@ -383,8 +379,6 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
|
|||||||
if self.__new_file:
|
if self.__new_file:
|
||||||
get_logger().info("Closing new image file ...")
|
get_logger().info("Closing new image file ...")
|
||||||
await self.__new_file.close()
|
await self.__new_file.close()
|
||||||
except asyncio.CancelledError: # pylint: disable=try-except-raise
|
|
||||||
raise
|
|
||||||
except Exception:
|
except Exception:
|
||||||
get_logger().exception("Can't close device file")
|
get_logger().exception("Can't close device file")
|
||||||
finally:
|
finally:
|
||||||
@ -429,8 +423,6 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
|
|||||||
if need_reload_state:
|
if need_reload_state:
|
||||||
await self.__reload_state()
|
await self.__reload_state()
|
||||||
await self.__state_notifier.notify()
|
await self.__state_notifier.notify()
|
||||||
except asyncio.CancelledError: # pylint: disable=try-except-raise
|
|
||||||
raise
|
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception("Unexpected MSD watcher error")
|
logger.exception("Unexpected MSD watcher error")
|
||||||
|
|
||||||
@ -451,8 +443,6 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
|
|||||||
await self.__remount_storage(rw=False)
|
await self.__remount_storage(rw=False)
|
||||||
|
|
||||||
storage_state = self.__get_storage_state()
|
storage_state = self.__get_storage_state()
|
||||||
except asyncio.CancelledError: # pylint: disable=try-except-raise
|
|
||||||
raise
|
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception("Error while reloading MSD state; switching to offline")
|
logger.exception("Error while reloading MSD state; switching to offline")
|
||||||
self.__state.storage = None
|
self.__state.storage = None
|
||||||
|
|||||||
@ -359,8 +359,6 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
|
|||||||
if self.__device_file:
|
if self.__device_file:
|
||||||
get_logger().info("Closing device file ...")
|
get_logger().info("Closing device file ...")
|
||||||
await self.__device_file.close()
|
await self.__device_file.close()
|
||||||
except asyncio.CancelledError: # pylint: disable=try-except-raise
|
|
||||||
raise
|
|
||||||
except Exception:
|
except Exception:
|
||||||
get_logger().exception("Can't close device file")
|
get_logger().exception("Can't close device file")
|
||||||
finally:
|
finally:
|
||||||
@ -374,8 +372,6 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
|
|||||||
try:
|
try:
|
||||||
self.__device_info = await aiotools.run_async(_explore_device, self.__device_path)
|
self.__device_info = await aiotools.run_async(_explore_device, self.__device_path)
|
||||||
break
|
break
|
||||||
except asyncio.CancelledError: # pylint: disable=try-except-raise
|
|
||||||
raise
|
|
||||||
except Exception:
|
except Exception:
|
||||||
if retries == 0:
|
if retries == 0:
|
||||||
self.__device_info = None
|
self.__device_info = None
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user