@defer.inlineCallbacks
    def set_state(self, target_user, state):
        status_msg = state.get("status_msg", None)
        presence = state["presence"]

        valid_presence = (
            PresenceState.ONLINE, PresenceState.UNAVAILABLE, PresenceState.OFFLINE
        )
        if presence not in valid_presence:
            raise SynapseError(400, "Invalid presence state")

        user_id = target_user.to_string()

        prev_state = yield self.current_state_for_user(user_id)

        new_fields = {
            "state": presence,
            "status_msg": status_msg if presence != PresenceState.OFFLINE else None
        }

        if presence == PresenceState.ONLINE:
            new_fields["last_active_ts"] = self.clock.time_msec()

        yield self._update_states([prev_state.copy_and_replace(**new_fields)])
Return True if the queue is full, False otherwise (not reliable!).
dataset/ETHPy150Open matrix-org/synapse/synapse/handlers/presence.py/PresenceHandler.set_state--crossover with--dataset/ETHPy150Open amrdraz/kodr/app/brython/www/src/Lib/queue.py/Queue.full