Ejemplo n.º 1
0
    def _process_presence_inner(self, states: List[UserPresenceState]):
        """Given a list of states populate self.pending_presence_by_dest and
        poke to send a new transaction to each destination
        """
        hosts_and_states = yield get_interested_remotes(
            self.store, states, self.state)

        for destinations, states in hosts_and_states:
            for destination in destinations:
                if destination == self.server_name:
                    continue
                self._get_per_destination_queue(destination).send_presence(
                    states)
Ejemplo n.º 2
0
    def _process_presence_inner(self, states):
        """Given a list of states populate self.pending_presence_by_dest and
        poke to send a new transaction to each destination

        Args:
            states (list(UserPresenceState))
        """
        hosts_and_states = yield get_interested_remotes(self.store, states, self.state)

        for destinations, states in hosts_and_states:
            for destination in destinations:
                if destination == self.server_name:
                    continue
                self._get_per_destination_queue(destination).send_presence(states)
Ejemplo n.º 3
0
    def _process_presence_inner(self, states: List[UserPresenceState]):
        """Given a list of states populate self.pending_presence_by_dest and
        poke to send a new transaction to each destination
        """
        hosts_and_states = yield defer.ensureDeferred(
            get_interested_remotes(self.store, states, self.state))

        for destinations, states in hosts_and_states:
            for destination in destinations:
                if destination == self.server_name:
                    continue

                if not self._federation_shard_config.should_handle(
                        self._instance_name, destination):
                    continue

                self._get_per_destination_queue(destination).send_presence(
                    states)
Ejemplo n.º 4
0
    def _process_presence_inner(self, states):
        """Given a list of states populate self.pending_presence_by_dest and
        poke to send a new transaction to each destination

        Args:
            states (list(UserPresenceState))
        """
        hosts_and_states = yield get_interested_remotes(
            self.store, states, self.state)

        for destinations, states in hosts_and_states:
            for destination in destinations:
                if not self.can_send_to(destination):
                    continue

                self.pending_presence_by_dest.setdefault(
                    destination,
                    {}).update({state.user_id: state
                                for state in states})

                self._attempt_new_transaction(destination)
Ejemplo n.º 5
0
    def _process_presence_inner(self, states):
        """Given a list of states populate self.pending_presence_by_dest and
        poke to send a new transaction to each destination

        Args:
            states (list(UserPresenceState))
        """
        hosts_and_states = yield get_interested_remotes(self.store, states, self.state)

        for destinations, states in hosts_and_states:
            for destination in destinations:
                if destination == self.server_name:
                    continue

                self.pending_presence_by_dest.setdefault(
                    destination, {}
                ).update({
                    state.user_id: state for state in states
                })

                self._attempt_new_transaction(destination)