@defer.inlineCallbacks
    def invite_to_room(self, room_name, sender, invitee):
        self._on_invite(self.server_name, room_name, invitee)

        destinations = yield self.get_servers_for_context(room_name)

        try:
            yield self.replication_layer.send_pdu(
                Pdu.create_new(
                    context=room_name,
                    is_state=True,
                    pdu_type="sy.room.member",
                    state_key=invitee,
                    content={"membership": "invite"},
                    origin=self.server_name,
                    destinations=destinations,
                )
            )
        except Exception as e:
            logger.exception(e)
Remove files in a temporary directory
dataset/ETHPy150Open matrix-org/synapse/contrib/experiments/test_messaging.py/HomeServer.invite_to_room--crossover with--dataset/ETHPy150Open perseas/Pyrseas/pyrseas/testutils.py/remove_temp_files