Skip to content

Commit e2feb72

Browse files
authored
Update utils.py
1 parent c500473 commit e2feb72

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

cx_Oracle_async/utils.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import asyncio
22
import cx_Oracle as csor
3+
import platform
34
from concurrent.futures import ThreadPoolExecutor
45

56
class AsyncCursorWarper:
@@ -87,7 +88,14 @@ def _test():
8788
8889
Issue if you have better implementation.
8990
'''
90-
self._thread_pool = ThreadPoolExecutor()
91+
pltfm = platform.system()
92+
if pltfm == 'Windows':
93+
_t_num = 512
94+
elif pltfm == 'Linux':
95+
_t_num = 1024
96+
else:
97+
raise RuntimeError("We havent decided how many threads should acquire on your platform. Maybe you have to modify source code your self.")
98+
self._thread_pool = ThreadPoolExecutor(max_workers = _t_num)
9199
self._loop = loop
92100
self._pool = pool
93101

@@ -114,4 +122,4 @@ async def __test():
114122
...
115123

116124
if __name__ == '__main__':
117-
asyncio.run(__test())
125+
asyncio.run(__test())

0 commit comments

Comments
 (0)