Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Split RoomMemberHandler into base and master class #2987

Merged
merged 5 commits into from
Mar 13, 2018

Conversation

erikjohnston
Copy link
Member

The intention here is to split the class into the bits that can be done
on workers and the bits that have to be done on the master.

In future there will also be a class that can be run on the worker,
which will delegate work to the master when necessary.

The intention here is to split the class into the bits that can be done
on workers and the bits that have to be done on the master.

In future there will also be a class that can be run on the worker,
which will delegate work to the master when necessary.
I added yields when calling user_left_room, but they shouldn't matter on
the master process as they always return None anyway.
@@ -31,6 +28,10 @@
from synapse.util.async import Linearizer
from synapse.util.distributor import user_left_room, user_joined_room

import abc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/matrix-org/synapse/blob/master/docs/code_style.rst:

As per PEP-8, imports should be grouped in the following order, with a blank line between each group:

standard library imports
related third party imports
local application/library specific imports

this is going in the opposite direction!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. I thought we always put e.g. import logging last tbh. (Doesn't your IDE rearrange imports into that order?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it does not.

self.distributor = hs.get_distributor()
self.distributor.declare("user_joined_room")
self.distributor.declare("user_left_room")
self.http_client = hs.get_simple_http_client()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be removed as its spurious


@abc.abstractmethod
def _user_left_room(self, target, room_id):
raise NotImplementedError()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These need to be docced.

@erikjohnston erikjohnston force-pushed the erikj/split_room_member_handler branch from b6c2b41 to 82f16fa Compare March 13, 2018 16:43
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks fair enough modulo some missing pydoc bits.

I'm assuming this will make a bit more sense once there is an impl for the worker

)
defer.returnValue({})

def get_or_register_3pid_guest(self, requester, medium, address, inviter_user_id):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason to pass requester here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, as we'll need to hit out to the master and we want to include the Requester in the logging there.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(We don't do it for the user_*_room as that just goes straight into the distributor which immediately strips the context)

"""Try and join a room that this server is not in

Args:
remote_room_hosts (list[str]): List of servers that can be used
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requester is missing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

likewise for some of the other methods

@richvdh richvdh assigned erikjohnston and unassigned richvdh Mar 13, 2018
@erikjohnston erikjohnston merged commit 1a69c6d into develop Mar 13, 2018
@erikjohnston erikjohnston deleted the erikj/split_room_member_handler branch March 22, 2018 13:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants