forked from MirrorHub/synapse
Minor PR comment tweaks.
This commit is contained in:
parent
f9232c7917
commit
835e01fc70
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -82,7 +82,7 @@ class DataStore(RoomMemberStore, RoomStore,
|
|||
FilteringStore,
|
||||
PusherStore,
|
||||
PushRuleStore,
|
||||
ApplicationServiceTransactionStore
|
||||
ApplicationServiceTransactionStore,
|
||||
):
|
||||
|
||||
def __init__(self, hs):
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue