mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-11 14:34:19 -05:00
Merge pull request #790 from matrix-org/markjh/liberate_sync_handler
Move SyncHandler out of the Handlers object
This commit is contained in:
commit
c4c98ce8da
@ -28,7 +28,6 @@ from .directory import DirectoryHandler
|
|||||||
from .typing import TypingNotificationHandler
|
from .typing import TypingNotificationHandler
|
||||||
from .admin import AdminHandler
|
from .admin import AdminHandler
|
||||||
from .appservice import ApplicationServicesHandler
|
from .appservice import ApplicationServicesHandler
|
||||||
from .sync import SyncHandler
|
|
||||||
from .auth import AuthHandler
|
from .auth import AuthHandler
|
||||||
from .identity import IdentityHandler
|
from .identity import IdentityHandler
|
||||||
from .receipts import ReceiptsHandler
|
from .receipts import ReceiptsHandler
|
||||||
@ -65,7 +64,6 @@ class Handlers(object):
|
|||||||
as_api=asapi
|
as_api=asapi
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.sync_handler = SyncHandler(hs)
|
|
||||||
self.auth_handler = AuthHandler(hs)
|
self.auth_handler = AuthHandler(hs)
|
||||||
self.identity_handler = IdentityHandler(hs)
|
self.identity_handler = IdentityHandler(hs)
|
||||||
self.search_handler = SearchHandler(hs)
|
self.search_handler = SearchHandler(hs)
|
||||||
|
@ -13,8 +13,6 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from ._base import BaseHandler
|
|
||||||
|
|
||||||
from synapse.streams.config import PaginationConfig
|
from synapse.streams.config import PaginationConfig
|
||||||
from synapse.api.constants import Membership, EventTypes
|
from synapse.api.constants import Membership, EventTypes
|
||||||
from synapse.util.async import concurrently_execute
|
from synapse.util.async import concurrently_execute
|
||||||
@ -133,10 +131,12 @@ class SyncResult(collections.namedtuple("SyncResult", [
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SyncHandler(BaseHandler):
|
class SyncHandler(object):
|
||||||
|
|
||||||
def __init__(self, hs):
|
def __init__(self, hs):
|
||||||
super(SyncHandler, self).__init__(hs)
|
self.store = hs.get_datastore()
|
||||||
|
self.notifier = hs.get_notifier()
|
||||||
|
self.presence_handler = hs.get_presence_handler()
|
||||||
self.event_sources = hs.get_event_sources()
|
self.event_sources = hs.get_event_sources()
|
||||||
self.clock = hs.get_clock()
|
self.clock = hs.get_clock()
|
||||||
self.response_cache = ResponseCache()
|
self.response_cache = ResponseCache()
|
||||||
@ -639,7 +639,7 @@ class SyncHandler(BaseHandler):
|
|||||||
|
|
||||||
# For each newly joined room, we want to send down presence of
|
# For each newly joined room, we want to send down presence of
|
||||||
# existing users.
|
# existing users.
|
||||||
presence_handler = self.hs.get_presence_handler()
|
presence_handler = self.presence_handler
|
||||||
extra_presence_users = set()
|
extra_presence_users = set()
|
||||||
for room_id in newly_joined_rooms:
|
for room_id in newly_joined_rooms:
|
||||||
users = yield self.store.get_users_in_room(event.room_id)
|
users = yield self.store.get_users_in_room(event.room_id)
|
||||||
|
@ -79,8 +79,7 @@ class SyncRestServlet(RestServlet):
|
|||||||
def __init__(self, hs):
|
def __init__(self, hs):
|
||||||
super(SyncRestServlet, self).__init__()
|
super(SyncRestServlet, self).__init__()
|
||||||
self.auth = hs.get_auth()
|
self.auth = hs.get_auth()
|
||||||
self.event_stream_handler = hs.get_handlers().event_stream_handler
|
self.sync_handler = hs.get_sync_handler()
|
||||||
self.sync_handler = hs.get_handlers().sync_handler
|
|
||||||
self.clock = hs.get_clock()
|
self.clock = hs.get_clock()
|
||||||
self.filtering = hs.get_filtering()
|
self.filtering = hs.get_filtering()
|
||||||
self.presence_handler = hs.get_presence_handler()
|
self.presence_handler = hs.get_presence_handler()
|
||||||
|
@ -28,6 +28,7 @@ from synapse.notifier import Notifier
|
|||||||
from synapse.api.auth import Auth
|
from synapse.api.auth import Auth
|
||||||
from synapse.handlers import Handlers
|
from synapse.handlers import Handlers
|
||||||
from synapse.handlers.presence import PresenceHandler
|
from synapse.handlers.presence import PresenceHandler
|
||||||
|
from synapse.handlers.sync import SyncHandler
|
||||||
from synapse.state import StateHandler
|
from synapse.state import StateHandler
|
||||||
from synapse.storage import DataStore
|
from synapse.storage import DataStore
|
||||||
from synapse.util import Clock
|
from synapse.util import Clock
|
||||||
@ -80,6 +81,7 @@ class HomeServer(object):
|
|||||||
'rest_servlet_factory',
|
'rest_servlet_factory',
|
||||||
'state_handler',
|
'state_handler',
|
||||||
'presence_handler',
|
'presence_handler',
|
||||||
|
'sync_handler',
|
||||||
'notifier',
|
'notifier',
|
||||||
'distributor',
|
'distributor',
|
||||||
'client_resource',
|
'client_resource',
|
||||||
@ -169,6 +171,9 @@ class HomeServer(object):
|
|||||||
def build_presence_handler(self):
|
def build_presence_handler(self):
|
||||||
return PresenceHandler(self)
|
return PresenceHandler(self)
|
||||||
|
|
||||||
|
def build_sync_handler(self):
|
||||||
|
return SyncHandler(self)
|
||||||
|
|
||||||
def build_event_sources(self):
|
def build_event_sources(self):
|
||||||
return EventSources(self)
|
return EventSources(self)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user