def process_sync_replication(self) -> None:
        """Process synchronous replication behavior on the primary."""
        if self.is_quorum_commit_mode():
            # The synchronous_standby_names was adjusted right before promote.
            # After that, when postgres has become a primary, we need to reflect this change
            # in the /sync key. Further changes of synchronous_standby_names and /sync key should
            # be postponed for `loop_wait` seconds, to give a chance to some replicas to start streaming.
            # In opposite case the /sync key will end up without synchronous nodes.
            if self.state_handler.is_primary():
                if self._promote_timestamp == 0 or time.time() - self._promote_timestamp > self.dcs.loop_wait:
                    self._process_quorum_replication()
                if self._promote_timestamp == 0:
                    self._promote_timestamp = time.time()
        elif self.is_synchronous_mode():
            self._process_multisync_replication()
        else:
            self.disable_synchronous_replication()
Process synchronous replication behavior on the primary.
patroni/ha.py