def copy_and_advance(self, key, new_value):
        new_token = self.copy_and_replace(key, new_value)
        if key == "room_key":
            new_id = new_token.room_stream_id
            old_id = self.room_stream_id
        else:
            new_id = int(getattr(new_token, key))
            old_id = int(getattr(self, key))
        if old_id < new_id:
            return new_token
        else:
            return self
Performs a batch Datastore operation on a sequence of keys or entities.
dataset/ETHPy150Open matrix-org/synapse/synapse/types.py/StreamToken.copy_and_advance--crossover with--dataset/ETHPy150Open google/cauliflowervest/src/cauliflowervest/server/cron/group_sync.py/GroupSync._BatchDatastoreOp