summaryrefslogtreecommitdiff
path: root/django/utils/autoreload.py
diff options
context:
space:
mode:
authorJacob Green <jacob@workflowy.com>2019-04-23 09:08:05 -0700
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-04-26 12:55:49 +0200
commited3c59097a01ed3f32f8a8bed95307fb5c181251 (patch)
treec972573ddf63b5779837c357d51412ced8a7c974 /django/utils/autoreload.py
parentefeceba589974b95b35b2e25df86498c96315518 (diff)
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.
Diffstat (limited to 'django/utils/autoreload.py')
-rw-r--r--django/utils/autoreload.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py
index 427d979a7f..4a68fb05d0 100644
--- a/django/utils/autoreload.py
+++ b/django/utils/autoreload.py
@@ -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: