def __remove_gone_nodes(self) -> Iterator[Transition]:
        """Remove inactive nodes from ``synchronous_standby_names`` and from ``/sync`` key.

        :yields: transitions as :class:`Transition` objects.
        """
        to_remove = self.sync - self.active
        if to_remove and self.sync == to_remove:
            logger.debug("Removing nodes: %s", to_remove)
            yield from self.quorum_update(0, CaseInsensitiveSet(), adjust_quorum=False)
            yield from self.sync_update(0, CaseInsensitiveSet())
        elif to_remove:
            logger.debug("Removing nodes: %s", to_remove)
            can_reduce_quorum_by = self.quorum
            # If we can reduce quorum size try to do so first
            if can_reduce_quorum_by:
                # Pick nodes to remove by sorted order to provide deterministic behavior for tests
                remove = CaseInsensitiveSet(sorted(to_remove, reverse=True)[:can_reduce_quorum_by])
                sync = CaseInsensitiveSet(self.sync - remove)
                # when removing nodes from sync we can safely increase numsync if requested
                numsync = min(self.sync_wanted if self.sync_wanted > self.numsync else self.numsync, len(sync))
                yield from self.sync_update(numsync, sync)
                voters = CaseInsensitiveSet(self.voters - remove)
                to_remove &= self.sync
                yield from self.quorum_update(len(voters) - self.numsync, voters,
                                              adjust_quorum=not to_remove)
            if to_remove:
                assert self.quorum == 0
                numsync = self.numsync - len(to_remove)
                sync = CaseInsensitiveSet(self.sync - to_remove)
                voters = CaseInsensitiveSet(self.voters - to_remove)
                sync_decrease = numsync - min(self.sync_wanted, len(sync))
                quorum = min(sync_decrease, len(voters) - 1) if sync_decrease else 0
                yield from self.quorum_update(quorum, voters, adjust_quorum=False)
                yield from self.sync_update(numsync, sync)
Remove inactive nodes from ``synchronous_standby_names`` and from ``/sync`` key.

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