fix(openlist): transfer queue blocking

This commit is contained in:
wumode
2026-03-06 23:21:43 +08:00
parent 4bdf16331d
commit 600b6af876

View File

@@ -9,6 +9,7 @@ from app.core.cache import cached
from app.core.config import settings, global_vars from app.core.config import settings, global_vars
from app.log import logger from app.log import logger
from app.modules.filemanager.storages import StorageBase, transfer_process from app.modules.filemanager.storages import StorageBase, transfer_process
from app.schemas.exception import OperationInterrupted
from app.schemas.types import StorageSchema from app.schemas.types import StorageSchema
from app.utils.http import RequestUtils from app.utils.http import RequestUtils
from app.utils.singleton import WeakSingleton from app.utils.singleton import WeakSingleton
@@ -672,7 +673,7 @@ class Alist(StorageBase, metaclass=WeakSingleton):
def read(self, size=-1): def read(self, size=-1):
if global_vars.is_transfer_stopped(path.as_posix()): if global_vars.is_transfer_stopped(path.as_posix()):
logger.info(f"【OpenList】{path} 上传已取消!") logger.info(f"【OpenList】{path} 上传已取消!")
return None raise OperationInterrupted(f"Upload cancelled: {path}")
chunk = self.file.read(size) chunk = self.file.read(size)
if chunk: if chunk:
self.uploaded_size += len(chunk) self.uploaded_size += len(chunk)
@@ -691,6 +692,8 @@ class Alist(StorageBase, metaclass=WeakSingleton):
self.__get_api_url("/api/fs/put"), self.__get_api_url("/api/fs/put"),
data=progress_reader, data=progress_reader,
) )
except OperationInterrupted:
return None
finally: finally:
progress_reader.close() progress_reader.close()