@@ -297,7 +297,11 @@ def __init__(
297
297
if self .credential is not None :
298
298
weakref .finalize (self , sync , self .loop , close_credential , self )
299
299
300
- self .max_concurrency = max_concurrency or (_get_batch_size () // 4 )
300
+ if max_concurrency is None :
301
+ batch_size = _get_batch_size ()
302
+ if batch_size > 0 :
303
+ max_concurrency = batch_size
304
+ self .max_concurrency = max_concurrency
301
305
302
306
@classmethod
303
307
def _strip_protocol (cls , path : str ):
@@ -1453,6 +1457,12 @@ async def _pipe_file(
1453
1457
1454
1458
pipe_file = sync_wrapper (_pipe_file )
1455
1459
1460
+ async def _pipe (self , * args , batch_size = None , max_concurrency = None , ** kwargs ):
1461
+ max_concurrency = max_concurrency or 1
1462
+ return await super ()._pipe (
1463
+ * args , batch_size = batch_size , max_concurrency = max_concurrency , ** kwargs
1464
+ )
1465
+
1456
1466
async def _cat_file (
1457
1467
self , path , start = None , end = None , max_concurrency = None , ** kwargs
1458
1468
):
@@ -1512,6 +1522,12 @@ def cat(self, path, recursive=False, on_error="raise", **kwargs):
1512
1522
else :
1513
1523
return self .cat_file (paths [0 ])
1514
1524
1525
+ async def _cat_ranges (self , * args , batch_size = None , max_concurrency = None , ** kwargs ):
1526
+ max_concurrency = max_concurrency or 1
1527
+ return await super ()._cat_ranges (
1528
+ * args , batch_size = batch_size , max_concurrency = max_concurrency , ** kwargs
1529
+ )
1530
+
1515
1531
def url (self , path , expires = 3600 , ** kwargs ):
1516
1532
return sync (self .loop , self ._url , path , expires , ** kwargs )
1517
1533
@@ -1656,6 +1672,12 @@ async def _put_file(
1656
1672
1657
1673
put_file = sync_wrapper (_put_file )
1658
1674
1675
+ async def _put (self , * args , batch_size = None , max_concurrency = None , ** kwargs ):
1676
+ max_concurrency = max_concurrency or 1
1677
+ return await super ()._put (
1678
+ * args , batch_size = batch_size , max_concurrency = max_concurrency , ** kwargs
1679
+ )
1680
+
1659
1681
async def _cp_file (self , path1 , path2 , ** kwargs ):
1660
1682
"""Copy the file at path1 to path2"""
1661
1683
container1 , path1 , version_id = self .split_path (path1 , delimiter = "/" )
@@ -1722,6 +1744,12 @@ async def _get_file(
1722
1744
1723
1745
get_file = sync_wrapper (_get_file )
1724
1746
1747
+ async def _get (self , * args , batch_size = None , max_concurrency = None , ** kwargs ):
1748
+ max_concurrency = max_concurrency or 1
1749
+ return await super ()._get (
1750
+ * args , batch_size = batch_size , max_concurrency = max_concurrency , ** kwargs
1751
+ )
1752
+
1725
1753
def getxattr (self , path , attr ):
1726
1754
meta = self .info (path ).get ("metadata" , {})
1727
1755
return meta [attr ]
0 commit comments