Minor PR comment tweaks.

This commit is contained in:
Kegan Dougal 2015-03-16 10:16:59 +00:00
parent f9232c7917
commit 835e01fc70
5 changed files with 19 additions and 13 deletions

View file

@ -86,7 +86,7 @@ class AppServiceScheduler(object):
self.txn_ctrl.start_polling()
def submit_event_for_as(self, service, event):
self.event_grouper.on_receive(service, event)
self.event_grouper.enqueue(service, event)
class _EventGrouper(object):
@ -96,7 +96,7 @@ class _EventGrouper(object):
def __init__(self):
self.groups = {} # dict of {service: [events]}
def on_receive(self, service, event):
def enqueue(self, service, event):
if service not in self.groups:
self.groups[service] = []
self.groups[service].append(event)

View file

@ -27,8 +27,14 @@ logger = logging.getLogger(__name__)
def log_failure(failure):
logger.error("Application Services Failure: %s", failure.value)
logger.error(failure.getTraceback())
logger.error(
"Application Services Failure",
exc_info=(
failure.type,
failure.value,
failure.getTracebackObject()
)
)
# NB: Purposefully not inheriting BaseHandler since that contains way too much

View file

@ -82,7 +82,7 @@ class DataStore(RoomMemberStore, RoomStore,
FilteringStore,
PusherStore,
PushRuleStore,
ApplicationServiceTransactionStore
ApplicationServiceTransactionStore,
):
def __init__(self, hs):

View file

@ -365,9 +365,9 @@ class ApplicationServiceTransactionStore(SQLBaseStore):
may be empty.
"""
sql = (
"SELECT r.*, a.* FROM application_services_state AS s LEFT JOIN "
"application_services AS a ON a.id=s.as_id LEFT JOIN "
"application_services_regex AS r ON r.as_id=a.id WHERE state = ?"
"SELECT r.*, a.* FROM application_services_state AS s LEFT JOIN"
" application_services AS a ON a.id=s.as_id LEFT JOIN"
" application_services_regex AS r ON r.as_id=a.id WHERE state = ?"
)
results = yield self._execute_and_decode(
"get_appservices_by_state", sql, state

View file

@ -213,7 +213,7 @@ class ApplicationServiceSchedulerEventGrouperTestCase(unittest.TestCase):
def test_drain_single_event(self):
service = Mock()
event = Mock()
self.grouper.on_receive(service, event)
self.grouper.enqueue(service, event)
groups = self.grouper.drain_groups()
self.assertTrue(service in groups)
self.assertEquals([event], groups[service])
@ -225,7 +225,7 @@ class ApplicationServiceSchedulerEventGrouperTestCase(unittest.TestCase):
service = Mock()
events = [Mock(), Mock(), Mock()]
for e in events:
self.grouper.on_receive(service, e)
self.grouper.enqueue(service, e)
groups = self.grouper.drain_groups()
self.assertTrue(service in groups)
self.assertEquals(events, groups[service])
@ -243,11 +243,11 @@ class ApplicationServiceSchedulerEventGrouperTestCase(unittest.TestCase):
services[2]: events_c
}
for e in events_b:
self.grouper.on_receive(services[1], e)
self.grouper.enqueue(services[1], e)
for e in events_c:
self.grouper.on_receive(services[2], e)
self.grouper.enqueue(services[2], e)
for e in events_a:
self.grouper.on_receive(services[0], e)
self.grouper.enqueue(services[0], e)
groups = self.grouper.drain_groups()
for service in services: