Преглед изворни кода

Only show waiting to die messages every three seconds.

Chris McDonough пре 18 година
родитељ
комит
0398127737
2 измењених фајлова са 14 додато и 3 уклоњено
  1. 6 0
      CHANGES.txt
  2. 8 3
      src/supervisor/supervisord.py

+ 6 - 0
CHANGES.txt

@@ -7,6 +7,12 @@
     socket file, so the process could not be controlled (it and all of
     socket file, so the process could not be controlled (it and all of
     its subprocesses would need to be killed by hand).
     its subprocesses would need to be killed by hand).
 
 
+  - When a process was not killable with a "normal" signal at shutdown
+    time, too many "INFO: waiting for x to die" messages would be sent
+    to the log until we ended up killing the process with a SIGKILL.
+    Now a maximum of one every three seconds is sent up until SIGKILL
+    time.  Thanks to Ian Bicking.
+
 2.1b2
 2.1b2
 
 
   - Added new tailProcessLog() command to the XML-RPC API that
   - Added new tailProcessLog() command to the XML-RPC API that

+ 8 - 3
src/supervisor/supervisord.py

@@ -430,6 +430,7 @@ class Subprocess:
 class Supervisor:
 class Supervisor:
     mood = 1 # 1: up, 0: restarting, -1: suicidal
     mood = 1 # 1: up, 0: restarting, -1: suicidal
     stopping = False # set after we detect that we are handling a stop request
     stopping = False # set after we detect that we are handling a stop request
+    lastdelayreport = 0
 
 
     def __init__(self, options):
     def __init__(self, options):
         self.options = options
         self.options = options
@@ -515,9 +516,13 @@ class Supervisor:
                 # everything), it's OK to stop or reload
                 # everything), it's OK to stop or reload
                 delayprocs = self.get_delay_processes()
                 delayprocs = self.get_delay_processes()
                 if delayprocs:
                 if delayprocs:
-                    names = [ p.config.name for p in delayprocs]
-                    namestr = ', '.join(names)
-                    self.options.logger.info('waiting for %s to die' % namestr)
+                    now = time.time()
+                    if now > (self.lastdelayreport + 3): # every 3 secs
+                        names = [ p.config.name for p in delayprocs]
+                        namestr = ', '.join(names)
+                        self.options.logger.info('waiting for %s to die' %
+                                                 namestr)
+                        self.lastdelayreport = now
                 else:
                 else:
                     break
                     break