Преглед на файлове

beenstarted not actually necessary (use laststart instead).

Chris McDonough преди 19 години
родител
ревизия
5beb2a91f1
променени са 2 файла, в които са добавени 4 реда и са изтрити 7 реда
  1. 1 3
      src/supervisor/supervisord.py
  2. 3 4
      src/supervisor/tests.py

+ 1 - 3
src/supervisor/supervisord.py

@@ -89,7 +89,6 @@ class Subprocess:
     # Initial state; overridden by instance variables
 
     pid = 0 # Subprocess pid; 0 when not running
-    beenstarted = False # true if has been started at least once
     laststart = 0 # Last time the subprocess was started; 0 if never
     laststop = 0  # Last time the subprocess was stopped; 0 if never
     delay = 0 # If nonzero, delay starting or killing until this time
@@ -204,7 +203,6 @@ class Subprocess:
             self.options.logger.critical(msg)
             return
 
-        self.beenstarted = True
         self.killing = 0
         self.spawnerr = None
         self.exitstatus = None
@@ -430,7 +428,7 @@ class Subprocess:
                 return ProcessStates.KILLED
             elif self.exitstatus is not None:
                 return ProcessStates.EXITED
-            elif not self.beenstarted:
+            elif not self.laststart:
                 return ProcessStates.NOTSTARTED
             else:
                 return ProcessStates.UNKNOWN

+ 3 - 4
src/supervisor/tests.py

@@ -903,7 +903,7 @@ class SubprocessTests(unittest.TestCase):
         instance = self._makeOne(options, config)
         self.assertEqual(instance.options, options)
         self.assertEqual(instance.config, config)
-        self.assertEqual(instance.beenstarted, False)
+        self.assertEqual(instance.laststart, 0)
         self.assertEqual(instance.childlog.args, (config.logfile, 10,
                                                   '%(message)s', 0, 0))
         self.assertEqual(instance.pid, 0)
@@ -1411,11 +1411,11 @@ class SubprocessTests(unittest.TestCase):
         self.assertEqual(instance.get_state(), ProcessStates.EXITED)
         
         instance = self._makeOne(options, config)
-        instance.options.beenstarted = False
+        instance.options.laststart = 0
         self.assertEqual(instance.get_state(), ProcessStates.NOTSTARTED)
 
         instance = self._makeOne(options, config)
-        instance.beenstarted = True
+        instance.laststart = 1
         self.assertEqual(instance.get_state(), ProcessStates.UNKNOWN)
 
 class XMLRPCMarshallingTests(unittest.TestCase):
@@ -1988,7 +1988,6 @@ class TailFProducerTests(unittest.TestCase):
 class DummyProcess:
     # Initial state; overridden by instance variables
     pid = 0 # Subprocess pid; 0 when not running
-    beenstarted = False
     laststart = 0 # Last time the subprocess was started; 0 if never
     laststop = 0  # Last time the subprocess was stopped; 0 if never
     delay = 0 # If nonzero, delay starting or killing until this time