diff --git a/src/backend/replication/syncrep.c b/src/backend/replication/syncrep.c
index 6692027..6e120f3 100644
--- a/src/backend/replication/syncrep.c
+++ b/src/backend/replication/syncrep.c
@@ -64,7 +64,13 @@ char	   *SyncRepStandbyNames;
 #define SyncStandbysDefined() \
 	(SyncRepStandbyNames != NULL && SyncRepStandbyNames[0] != '\0')
 
-static bool announce_next_takeover = true;
+typedef enum syncrep_state {
+	SSTATE_NONE,
+	SSTATE_POTENTIAL,
+	SSTATE_SYNC,
+} sync_state;
+
+static sync_state syncrep_state = SSTATE_NONE;
 
 SyncRepConfigData *SyncRepConfig;
 static int	SyncRepWaitMode = SYNC_REP_NO_WAIT;
@@ -416,22 +422,26 @@ SyncRepReleaseWaiters(void)
 	 * If we are managing the sync standby, though we weren't
 	 * prior to this, then announce we are now the sync standby.
 	 */
-	if (announce_next_takeover && am_sync)
+	if ((syncrep_state != SSTATE_POTENTIAL &&
+		 !am_sync && MyWalSnd->sync_standby_priority > 0) ||
+		(syncrep_state != SSTATE_SYNC && am_sync))
 	{
-		announce_next_takeover = false;
 		ereport(LOG,
-				(errmsg("standby \"%s\" is now the synchronous standby with priority %u",
-						application_name, MyWalSnd->sync_standby_priority)));
+					(errmsg("standby \"%s\" is now a %ssynchronous standby with priority %u",
+							application_name,
+							am_sync ? "" : "potential ",
+							MyWalSnd->sync_standby_priority)));
+		syncrep_state = (am_sync ? SSTATE_SYNC : SSTATE_POTENTIAL);
 	}
 
 	/*
 	 * If the number of sync standbys is less than requested or we aren't
 	 * managing the sync standby then just leave.
 	 */
-	if (!got_oldest || !am_sync)
+	if (!got_oldest || MyWalSnd->sync_standby_priority == 0)
 	{
 		LWLockRelease(SyncRepLock);
-		announce_next_takeover = !am_sync;
+		syncrep_state = SSTATE_NONE;
 		return;
 	}
 
