mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-09-08 05:51:57 +00:00
Fix bug where pusherpool didn't start and broke some rooms
Since we didn't instansiate the PusherPool at start time it could fail at run time, which it did for some users. This may or may not fix things for those users, but it should happen at start time and stop the server from starting.
This commit is contained in:
parent
42b50483be
commit
5a7f561a9b
@ -76,6 +76,7 @@ class FederationHandler(BaseHandler):
|
|||||||
self.keyring = hs.get_keyring()
|
self.keyring = hs.get_keyring()
|
||||||
self.action_generator = hs.get_action_generator()
|
self.action_generator = hs.get_action_generator()
|
||||||
self.is_mine_id = hs.is_mine_id
|
self.is_mine_id = hs.is_mine_id
|
||||||
|
self.pusher_pool = hs.get_pusherpool()
|
||||||
|
|
||||||
self.replication_layer.set_handler(self)
|
self.replication_layer.set_handler(self)
|
||||||
|
|
||||||
@ -1426,7 +1427,7 @@ class FederationHandler(BaseHandler):
|
|||||||
if not backfilled:
|
if not backfilled:
|
||||||
# this intentionally does not yield: we don't care about the result
|
# this intentionally does not yield: we don't care about the result
|
||||||
# and don't need to wait for it.
|
# and don't need to wait for it.
|
||||||
preserve_fn(self.hs.get_pusherpool().on_new_notifications)(
|
preserve_fn(self.pusher_pool.on_new_notifications)(
|
||||||
event_stream_id, max_stream_id
|
event_stream_id, max_stream_id
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -50,6 +50,8 @@ class MessageHandler(BaseHandler):
|
|||||||
|
|
||||||
self.pagination_lock = ReadWriteLock()
|
self.pagination_lock = ReadWriteLock()
|
||||||
|
|
||||||
|
self.pusher_pool = hs.get_pusherpool()
|
||||||
|
|
||||||
# We arbitrarily limit concurrent event creation for a room to 5.
|
# We arbitrarily limit concurrent event creation for a room to 5.
|
||||||
# This is to stop us from diverging history *too* much.
|
# This is to stop us from diverging history *too* much.
|
||||||
self.limiter = Limiter(max_count=5)
|
self.limiter = Limiter(max_count=5)
|
||||||
@ -610,7 +612,7 @@ class MessageHandler(BaseHandler):
|
|||||||
|
|
||||||
# this intentionally does not yield: we don't care about the result
|
# this intentionally does not yield: we don't care about the result
|
||||||
# and don't need to wait for it.
|
# and don't need to wait for it.
|
||||||
preserve_fn(self.hs.get_pusherpool().on_new_notifications)(
|
preserve_fn(self.pusher_pool.on_new_notifications)(
|
||||||
event_stream_id, max_stream_id
|
event_stream_id, max_stream_id
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -73,6 +73,7 @@ class PushersSetRestServlet(ClientV1RestServlet):
|
|||||||
def __init__(self, hs):
|
def __init__(self, hs):
|
||||||
super(PushersSetRestServlet, self).__init__(hs)
|
super(PushersSetRestServlet, self).__init__(hs)
|
||||||
self.notifier = hs.get_notifier()
|
self.notifier = hs.get_notifier()
|
||||||
|
self.pusher_pool = self.hs.get_pusherpool()
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def on_POST(self, request):
|
def on_POST(self, request):
|
||||||
@ -81,12 +82,10 @@ class PushersSetRestServlet(ClientV1RestServlet):
|
|||||||
|
|
||||||
content = parse_json_object_from_request(request)
|
content = parse_json_object_from_request(request)
|
||||||
|
|
||||||
pusher_pool = self.hs.get_pusherpool()
|
|
||||||
|
|
||||||
if ('pushkey' in content and 'app_id' in content
|
if ('pushkey' in content and 'app_id' in content
|
||||||
and 'kind' in content and
|
and 'kind' in content and
|
||||||
content['kind'] is None):
|
content['kind'] is None):
|
||||||
yield pusher_pool.remove_pusher(
|
yield self.pusher_pool.remove_pusher(
|
||||||
content['app_id'], content['pushkey'], user_id=user.to_string()
|
content['app_id'], content['pushkey'], user_id=user.to_string()
|
||||||
)
|
)
|
||||||
defer.returnValue((200, {}))
|
defer.returnValue((200, {}))
|
||||||
@ -109,14 +108,14 @@ class PushersSetRestServlet(ClientV1RestServlet):
|
|||||||
append = content['append']
|
append = content['append']
|
||||||
|
|
||||||
if not append:
|
if not append:
|
||||||
yield pusher_pool.remove_pushers_by_app_id_and_pushkey_not_user(
|
yield self.pusher_pool.remove_pushers_by_app_id_and_pushkey_not_user(
|
||||||
app_id=content['app_id'],
|
app_id=content['app_id'],
|
||||||
pushkey=content['pushkey'],
|
pushkey=content['pushkey'],
|
||||||
not_user_id=user.to_string()
|
not_user_id=user.to_string()
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
yield pusher_pool.add_pusher(
|
yield self.pusher_pool.add_pusher(
|
||||||
user_id=user.to_string(),
|
user_id=user.to_string(),
|
||||||
access_token=requester.access_token_id,
|
access_token=requester.access_token_id,
|
||||||
kind=content['kind'],
|
kind=content['kind'],
|
||||||
@ -152,6 +151,7 @@ class PushersRemoveRestServlet(RestServlet):
|
|||||||
self.hs = hs
|
self.hs = hs
|
||||||
self.notifier = hs.get_notifier()
|
self.notifier = hs.get_notifier()
|
||||||
self.auth = hs.get_v1auth()
|
self.auth = hs.get_v1auth()
|
||||||
|
self.pusher_pool = self.hs.get_pusherpool()
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def on_GET(self, request):
|
def on_GET(self, request):
|
||||||
@ -161,10 +161,8 @@ class PushersRemoveRestServlet(RestServlet):
|
|||||||
app_id = parse_string(request, "app_id", required=True)
|
app_id = parse_string(request, "app_id", required=True)
|
||||||
pushkey = parse_string(request, "pushkey", required=True)
|
pushkey = parse_string(request, "pushkey", required=True)
|
||||||
|
|
||||||
pusher_pool = self.hs.get_pusherpool()
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
yield pusher_pool.remove_pusher(
|
yield self.pusher_pool.remove_pusher(
|
||||||
app_id=app_id,
|
app_id=app_id,
|
||||||
pushkey=pushkey,
|
pushkey=pushkey,
|
||||||
user_id=user.to_string(),
|
user_id=user.to_string(),
|
||||||
|
Loading…
Reference in New Issue
Block a user