Fixes from PR comments

This commit is contained in:
Kegan Dougal 2015-03-26 10:11:52 +00:00
parent 4edcbcee3b
commit 32206dde3f
2 changed files with 4 additions and 3 deletions

View File

@ -112,7 +112,7 @@ class _ServiceQueuer(object):
def _send_request(self, service, events): def _send_request(self, service, events):
# send request and add callbacks # send request and add callbacks
d = self.txn_ctrl.send(service, events) d = self.txn_ctrl.send(service, events)
d.addCallback(self._on_request_finish) d.addBoth(self._on_request_finish)
d.addErrback(self._on_request_fail) d.addErrback(self._on_request_fail)
self.pending_requests[service.id] = d self.pending_requests[service.id] = d
@ -154,6 +154,7 @@ class _TransactionController(object):
self._start_recoverer(service) self._start_recoverer(service)
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)
self._start_recoverer(service)
# request has finished # request has finished
defer.returnValue(service) defer.returnValue(service)

View File

@ -37,7 +37,7 @@ class ApplicationServiceStore(SQLBaseStore):
def __init__(self, hs): def __init__(self, hs):
super(ApplicationServiceStore, self).__init__(hs) super(ApplicationServiceStore, self).__init__(hs)
self.services_cache = [] self.services_cache = []
self.cache_defer = self._populate_cache() self.cache_defer = self._populate_appservice_cache()
self.cache_defer.addErrback(log_failure) self.cache_defer.addErrback(log_failure)
@defer.inlineCallbacks @defer.inlineCallbacks
@ -337,7 +337,7 @@ class ApplicationServiceStore(SQLBaseStore):
return service_list return service_list
@defer.inlineCallbacks @defer.inlineCallbacks
def _populate_cache(self): def _populate_appservice_cache(self):
"""Populates the ApplicationServiceCache from the database.""" """Populates the ApplicationServiceCache from the database."""
sql = ("SELECT r.*, a.* FROM application_services AS a LEFT JOIN " sql = ("SELECT r.*, a.* FROM application_services AS a LEFT JOIN "
"application_services_regex AS r ON a.id = r.as_id") "application_services_regex AS r ON a.id = r.as_id")