Skip to content

Commit

Permalink
Remove some methods from classes where they shouldn't be.
Browse files Browse the repository at this point in the history
Somehow, some ConnectionContext-like methods made their way onto Connections. Nobody ever calls them there, so goodbye.
  • Loading branch information
erikrose authored and selenamarie committed Jun 10, 2013
1 parent 01c7a4e commit 967ee30
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 19 deletions.
6 changes: 0 additions & 6 deletions socorro/external/hb/connection_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ def commit(self):
def rollback(self):
pass

def in_transaction(self, dummy):
return False

def is_operational_exception(self, msg):
return True

def make_connection(self):
self.socket = TSocket.TSocket(self.config.hbase_host,
self.config.hbase_port)
Expand Down
3 changes: 0 additions & 3 deletions socorro/external/hbase/hbase_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,6 @@ def commit(self):
def rollback(self):
pass

def in_transaction(self, dummy):
return False

def is_operational_exception(self, msg):
return True

Expand Down
4 changes: 1 addition & 3 deletions socorro/external/rabbitmq/connection_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def in_transaction(self, connection):
return False

#--------------------------------------------------------------------------
# TODO: Factor this and close_connection (at least) up to a superclass.
@contextlib.contextmanager
def __call__(self, name=None):
"""returns a RabbitMQ connection wrapped in a contextmanager.
Expand All @@ -131,13 +132,10 @@ def __call__(self, name=None):
parameters:
name - an optional name for the RabbitMQ connection"""
#self.config.logger.debug('acquiring connection')
conn = self.connection(name)
try:
#self.config.logger.debug('connection acquired')
yield conn
finally:
#self.config.logger.debug('connection closed')
self.close_connection(conn)

#--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion socorro/external/rabbitmq/crashstorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def save_raw_crash(self, raw_crash, dumps, crash_id):
'not saving crash %s, legacy processing '
'flag is %d', crash_id, raw_crash_json.legacy_processing
)
except KeyError:
except KeyError: # TODO: overbroad "try" block
self.config.logger.debug(
'legacy_processing key absent in crash %s',
crash_id
Expand Down
3 changes: 0 additions & 3 deletions socorro/unittest/external/hb/test_connection_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ def commit(self):
def rollback(self):
self.rollback_counter += 1

def in_transaction(self):
return True


class TestConnectionContext(unittest.TestCase):
def test_basic_hbase_usage(self):
Expand Down
3 changes: 0 additions & 3 deletions socorro/unittest/external/hbase/test_connection_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ def commit(self):
def rollback(self):
self.rollback_counter += 1

def in_transaction(self):
return True


class TestConnectionContext(unittest.TestCase):

Expand Down

0 comments on commit 967ee30

Please sign in to comment.