We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents b4902ac + b85173c commit 2c8cdd1Copy full SHA for 2c8cdd1
asyncio_pool/base_pool.py
@@ -39,6 +39,9 @@ async def __aenter__(self):
39
async def __aexit__(self, ext_type, exc, tb):
40
await self.join()
41
42
+ def __len__(self):
43
+ return len(self._waiting) + self.n_active
44
+
45
@property
46
def n_active(self):
47
'''Counts active coroutines'''
@@ -52,7 +55,7 @@ def is_empty(self):
52
55
53
56
def is_full(self):
54
57
'''Returns `True` if `size` coroutines are already active.'''
- return self.size <= len(self._waiting) + self.n_active
58
+ return self.size <= len(self)
59
60
async def join(self):
61
'''Waits (blocks) for all spawned coroutines to finish, both active and
0 commit comments