We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f4043fe commit e14af00Copy full SHA for e14af00
rollbar/lib/thread_pool.py
@@ -1,4 +1,6 @@
1
import logging
2
+import os
3
+import sys
4
from concurrent.futures import ThreadPoolExecutor
5
6
_pool = None # type: ThreadPoolExecutor|None
@@ -10,8 +12,13 @@ def init_pool(max_workers):
10
12
"""
11
13
Creates the thread pool with the max workers.
14
- :type max_workers: int
15
+ :type max_workers: int|None
16
+ :param max_workers: If max_workers is None it will use the logic from the standard library to calculate the number
17
+ of threads. However, we ported the logic from Python 3.5 to earlier versions.
18
19
+ if max_workers is None and sys.version_info < (3, 5):
20
+ max_workers = (os.cpu_count() or 1) * 5
21
+
22
global _pool
23
_pool = ThreadPoolExecutor(max_workers)
24
0 commit comments