summaryrefslogtreecommitdiff
path: root/django/utils/autoreload.py
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-04-29 22:55:11 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-11-02 07:18:39 +0100
commitab943f031c3db32dd186d63cc5b9cae7c4ffc98e (patch)
tree77369a6e78f318a17208e22e286be41a6736dbef /django/utils/autoreload.py
parentf06beea92999407cc8dad3c47f006b7c727095a6 (diff)
Protected Watchman autoreloader against busy loops.
With an error in the loop above (e.g. using query without args), this would trigger a busy loop. While this was caused due to changes to the loop itself, it seems to be just good practice to protect against this.
Diffstat (limited to 'django/utils/autoreload.py')
-rw-r--r--django/utils/autoreload.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py
index 19326a5118..442ece1f6d 100644
--- a/django/utils/autoreload.py
+++ b/django/utils/autoreload.py
@@ -546,6 +546,8 @@ class WatchmanReloader(BaseReloader):
for sub in list(self.client.subs.keys()):
self._check_subscription(sub)
yield
+ # Protect against busy loops.
+ time.sleep(0.1)
def stop(self):
self.client.close()