From 4fc70b4be2f32f737861f3a294af9c0f07c224b3 Mon Sep 17 00:00:00 2001 From: Kevin Lange Date: Tue, 5 Feb 2013 10:59:35 -0800 Subject: [PATCH] Revert the reconnect branch --- gearman/connection.py | 13 ------------- gearman/connection_manager.py | 2 -- tests/_core_testing.py | 2 -- 3 files changed, 17 deletions(-) diff --git a/gearman/connection.py b/gearman/connection.py index bfd09a7..44f68ed 100644 --- a/gearman/connection.py +++ b/gearman/connection.py @@ -11,8 +11,6 @@ gearman_logger = logging.getLogger(__name__) -RECONNECT_TIMEOUT_DEFAULT = 60.0 - class GearmanConnection(object): """A connection between a client/worker and a server. Can be used to reconnect (unlike a socket) @@ -32,8 +30,6 @@ def __init__(self, host=None, port=DEFAULT_GEARMAN_PORT): self.gearman_host = host self.gearman_port = port - self.reconnect_timeout = RECONNECT_TIMEOUT_DEFAULT - if host is None: raise ServerUnavailable("No host specified") @@ -95,8 +91,6 @@ def connect(self): self._is_client_side = True self._is_server_side = False - self.connect_time = time.time() - def _create_client_socket(self): """Creates a client side socket and subsequently binds/configures our socket options""" try: @@ -195,13 +189,6 @@ def send_commands_to_buffer(self): self._outgoing_buffer = ''.join(packed_data) - def maybe_reconnect(self): - """If we don't have outgoing data waiting after a length of time, close the current connection and open a new one.""" - if self.connect_time < time.time() - self.reconnect_timeout: - if not self._outgoing_buffer: - self.close() - self.connect() - def send_data_to_socket(self): """Send data from buffer -> socket diff --git a/gearman/connection_manager.py b/gearman/connection_manager.py index e505e20..2638b79 100644 --- a/gearman/connection_manager.py +++ b/gearman/connection_manager.py @@ -90,9 +90,7 @@ def establish_connection(self, current_connection): !NOTE! This function can throw a ConnectionError which deriving ConnectionManagers should catch """ assert current_connection in self.connection_list, "Unknown connection - %r" % current_connection - if current_connection.connected: - current_connection.maybe_reconnect() return current_connection # !NOTE! May throw a ConnectionError diff --git a/tests/_core_testing.py b/tests/_core_testing.py index a7f567a..0a94868 100644 --- a/tests/_core_testing.py +++ b/tests/_core_testing.py @@ -20,8 +20,6 @@ def __init__(self, host=None, port=DEFAULT_GEARMAN_PORT): self._fail_on_bind = False self._fail_on_read = False self._fail_on_write = False - self.connect_time = 0.0 - self.reconnect_timeout = 0.0 def _create_client_socket(self): if self._fail_on_bind: