def __add_new_nodes(self) -> Iterator[Transition]:
        """Add new active nodes to ``synchronous_standby_names`` and to ``/sync`` key.

        :yields: transitions as :class:`Transition` objects.
        """
        to_add = self.active - self.sync
        if to_add:
            # First get to requested replication factor
            logger.debug("Adding nodes: %s", to_add)
            sync_wanted = min(self.sync_wanted, len(self.sync | to_add))
            increase_numsync_by = sync_wanted - self.numsync
            if increase_numsync_by > 0:
                if self.sync:
                    add = CaseInsensitiveSet(sorted(to_add)[:increase_numsync_by])
                    increase_numsync_by = len(add)
                else:  # there is only the leader
                    add = to_add  # and it is safe to add all nodes at once if sync is empty
                yield from self.sync_update(self.numsync + increase_numsync_by, CaseInsensitiveSet(self.sync | add))
                voters = CaseInsensitiveSet(self.voters | add)
                yield from self.quorum_update(len(voters) - sync_wanted, voters)
                to_add -= self.sync
            if to_add:
                voters = CaseInsensitiveSet(self.voters | to_add)
                yield from self.quorum_update(len(voters) - sync_wanted, voters,
                                              adjust_quorum=sync_wanted > self.numsync_confirmed)
                yield from self.sync_update(sync_wanted, CaseInsensitiveSet(self.sync | to_add))
Add new active nodes to ``synchronous_standby_names`` and to ``/sync`` key.

        :yields: transitions as :class:`Transition` objects.
        
patroni/quorum.py