mirror of
				https://github.com/devine-dl/devine.git
				synced 2025-11-04 03:44:49 +00:00 
			
		
		
		
	fix(requests): Manually compute default max_workers or pool size is None
This commit is contained in:
		
							parent
							
								
									458ad70fae
								
							
						
					
					
						commit
						36b070f729
					
				@ -1,4 +1,5 @@
 | 
				
			|||||||
import math
 | 
					import math
 | 
				
			||||||
 | 
					import os
 | 
				
			||||||
import time
 | 
					import time
 | 
				
			||||||
from concurrent import futures
 | 
					from concurrent import futures
 | 
				
			||||||
from concurrent.futures.thread import ThreadPoolExecutor
 | 
					from concurrent.futures.thread import ThreadPoolExecutor
 | 
				
			||||||
@ -196,6 +197,9 @@ def requests(
 | 
				
			|||||||
    if not isinstance(urls, list):
 | 
					    if not isinstance(urls, list):
 | 
				
			||||||
        urls = [urls]
 | 
					        urls = [urls]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if not max_workers:
 | 
				
			||||||
 | 
					        max_workers = min(32, (os.cpu_count() or 1) + 4)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    urls = [
 | 
					    urls = [
 | 
				
			||||||
        dict(
 | 
					        dict(
 | 
				
			||||||
            save_path=save_path,
 | 
					            save_path=save_path,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user