Skip to content
This repository has been archived by the owner on Apr 18, 2018. It is now read-only.

Commit

Permalink
Merge pull request #32 from klange/master
Browse files Browse the repository at this point in the history
Revert reconnect branch
  • Loading branch information
klange committed Feb 5, 2013
2 parents 19f6fe5 + 4fc70b4 commit c776df1
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 17 deletions.
13 changes: 0 additions & 13 deletions gearman/connection.py
Expand Up @@ -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)
Expand All @@ -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")

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions gearman/connection_manager.py
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions tests/_core_testing.py
Expand Up @@ -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:
Expand Down

0 comments on commit c776df1

Please sign in to comment.