mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[2.2.x] Fixed #30361 -- Increased the default timeout of watchman client to 5 seconds and made it customizable.
Made the default timeout of watchman client customizable via
DJANGO_WATCHMAN_TIMEOUT environment variable.
Backport of ed3c59097a from master
			
			
This commit is contained in:
		
				
					committed by
					
						 Mariusz Felisiak
						Mariusz Felisiak
					
				
			
			
				
	
			
			
			
						parent
						
							a4095dadc4
						
					
				
				
					commit
					e45763193f
				
			| @@ -366,11 +366,12 @@ class WatchmanReloader(BaseReloader): | ||||
|     def __init__(self): | ||||
|         self.roots = defaultdict(set) | ||||
|         self.processed_request = threading.Event() | ||||
|         self.client_timeout = int(os.environ.get('DJANGO_WATCHMAN_TIMEOUT', 5)) | ||||
|         super().__init__() | ||||
|  | ||||
|     @cached_property | ||||
|     def client(self): | ||||
|         return pywatchman.client() | ||||
|         return pywatchman.client(timeout=self.client_timeout) | ||||
|  | ||||
|     def _watch_root(self, root): | ||||
|         # In practice this shouldn't occur, however, it's possible that a | ||||
| @@ -528,7 +529,7 @@ class WatchmanReloader(BaseReloader): | ||||
|     def check_availability(cls): | ||||
|         if not pywatchman: | ||||
|             raise WatchmanUnavailable('pywatchman not installed.') | ||||
|         client = pywatchman.client(timeout=0.01) | ||||
|         client = pywatchman.client(timeout=0.1) | ||||
|         try: | ||||
|             result = client.capabilityCheck() | ||||
|         except Exception: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user