diff options
| author | Jacob Green <jacob@workflowy.com> | 2019-04-23 09:08:05 -0700 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-04-26 13:35:47 +0200 |
| commit | e45763193fe496cefc6749c45e6a31e62f987d63 (patch) | |
| tree | 14f54f837c9a4667f6d1b1085693cf0ca607c875 /django | |
| parent | a4095dadc4b165f615dfc88c6ed1cbba5b5a9844 (diff) | |
[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 ed3c59097a01ed3f32f8a8bed95307fb5c181251 from master
Diffstat (limited to 'django')
| -rw-r--r-- | django/utils/autoreload.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py index 33f2b2be96..d43342c2d7 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: |
