From ce49c91976fd30c8b5f223308d5618d6e414d99b Mon Sep 17 00:00:00 2001 From: Liu Hancheng Date: Thu, 5 Dec 2024 11:43:01 +0800 Subject: [PATCH 1/3] fix: un-awaited method --- src/ossfs/async_oss.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ossfs/async_oss.py b/src/ossfs/async_oss.py index 8a07b5e..f01b501 100644 --- a/src/ossfs/async_oss.py +++ b/src/ossfs/async_oss.py @@ -156,7 +156,10 @@ async def _call_oss( if not method: method = getattr(aiooss2, method_name) logger.debug("CALL: %s - %s - %s", method.__name__, args, kwargs) - out = method(service, *args, **kwargs) + if method_name =="resumable_upload": + out = await method(service, *args, **kwargs) + else: + out = method(service, *args, **kwargs) else: logger.debug("CALL: %s - %s - %s", method.__name__, args, kwargs) out = await method(*args, **kwargs) From b301ad5aa7771c347dd8149f7847df618ab15c71 Mon Sep 17 00:00:00 2001 From: Liu Hancheng Date: Thu, 5 Dec 2024 11:56:32 +0800 Subject: [PATCH 2/3] dev: use inspect.iscoroutinefunction to thorough fix the await problem --- src/ossfs/async_oss.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ossfs/async_oss.py b/src/ossfs/async_oss.py index f01b501..7fcc471 100644 --- a/src/ossfs/async_oss.py +++ b/src/ossfs/async_oss.py @@ -2,6 +2,7 @@ Code of AioOSSFileSystem """ import logging +import inspect import os import weakref from datetime import datetime @@ -156,7 +157,7 @@ async def _call_oss( if not method: method = getattr(aiooss2, method_name) logger.debug("CALL: %s - %s - %s", method.__name__, args, kwargs) - if method_name =="resumable_upload": + if inspect.iscoroutinefunction(method): out = await method(service, *args, **kwargs) else: out = method(service, *args, **kwargs) From 053823a206e1ad9b3ea77c06294b15dd65bb4d86 Mon Sep 17 00:00:00 2001 From: Liu Hancheng Date: Thu, 5 Dec 2024 12:11:42 +0800 Subject: [PATCH 3/3] chore: fix format issue --- src/ossfs/async_oss.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ossfs/async_oss.py b/src/ossfs/async_oss.py index 7fcc471..c43f329 100644 --- a/src/ossfs/async_oss.py +++ b/src/ossfs/async_oss.py @@ -1,8 +1,8 @@ """ Code of AioOSSFileSystem """ -import logging import inspect +import logging import os import weakref from datetime import datetime