소스 검색

Revert caching of server proxy object. Related to #259
This causes supervisorctl to become unusable if the connection
goes away during a session. It can be seen by issuing the ``reload``
command and then attempting another command.

Mike Naberezny 11 년 전
부모
커밋
a3124006e9
3개의 변경된 파일3개의 추가작업 그리고 17개의 파일을 삭제
  1. 0 3
      CHANGES.txt
  2. 3 6
      supervisor/supervisorctl.py
  3. 0 8
      supervisor/tests/test_supervisorctl.py

+ 0 - 3
CHANGES.txt

@@ -18,9 +18,6 @@
 - Removed ``setuptools`` from the ``requires`` list in ``setup.py`` because
   it caused installation issues on some systems.
 
-- Changed ``supervisorctl`` to reuse the server proxy object between commands
-  to reduce the number of open connections.  Patch by Zev Benjamin.
-
 - Fixed a bug in Medusa where the HTTP Basic authorizer would cause an
   exception if the password contained a colon.  Thanks to Thomas Guttler
   for reporting this issue.

+ 3 - 6
supervisor/supervisorctl.py

@@ -101,7 +101,6 @@ class Controller(cmd.Cmd):
         self.options = options
         self.prompt = self.options.prompt + '> '
         self.options.plugins = []
-        self.server_proxy = None
         self.vocab = ['add','exit','maintail','pid','reload',
                       'restart','start','stop','version','clear',
                       'fg','open','quit','remove','shutdown','status',
@@ -187,13 +186,11 @@ class Controller(cmd.Cmd):
         return self.get_server_proxy('supervisor')
 
     def get_server_proxy(self, namespace=None):
-        if self.server_proxy is None:
-            self.server_proxy = self.options.getServerProxy()
-
+        proxy = self.options.getServerProxy()
         if namespace is None:
-            return self.server_proxy
+            return proxy
         else:
-            return getattr(self.server_proxy, namespace)
+            return getattr(proxy, namespace)
 
     def upcheck(self):
         try:

+ 0 - 8
supervisor/tests/test_supervisorctl.py

@@ -142,14 +142,6 @@ class ControllerTests(unittest.TestCase):
         expected = options.getServerProxy().supervisor
         self.assertEqual(proxy, expected)
 
-    def test_get_supervisor_caches_serverproxy_instance(self):
-        options = DummyClientOptions()
-        controller = self._makeOne(options)
-
-        proxy_1 = controller.get_supervisor()
-        proxy_2 = controller.get_supervisor()
-        self.assertTrue(proxy_1 is proxy_2)
-
     def test_get_server_proxy_with_no_args_returns_serverproxy(self):
         options = DummyClientOptions()
         controller = self._makeOne(options)