]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Check for forked status in autoreload
authorBen Darnell <ben@bendarnell.com>
Tue, 5 Jul 2011 02:15:37 +0000 (19:15 -0700)
committerBen Darnell <ben@bendarnell.com>
Tue, 5 Jul 2011 02:15:37 +0000 (19:15 -0700)
tornado/autoreload.py

index 5d16d77c661e095bcf21d3587b3f4e6ae3230810..b34ace8859d0e8894a3ca018fce5e59e4f135449 100644 (file)
@@ -35,6 +35,7 @@ import sys
 import types
 
 from tornado import ioloop
+from tornado import process
 
 try:
     import signal
@@ -80,6 +81,11 @@ def _reload_on_update(io_loop, modify_times):
     if _reload_attempted:
         # We already tried to reload and it didn't work, so don't try again.
         return
+    if process.task_id() is not None:
+        # We're in a child process created by fork_processes.  If child
+        # processes restarted themselves, they'd all restart and then
+        # all call fork_processes again.
+        return
     for module in sys.modules.values():
         # Some modules play games with sys.modules (e.g. email/__init__.py
         # in the standard library), and occasionally this can cause strange