From 90f705c19001f4d6a2a648d5917c17ff4f0cda6b Mon Sep 17 00:00:00 2001 From: sacOO7 Date: Tue, 26 Mar 2024 18:22:54 +0530 Subject: [PATCH] fixed beforesyncmembers from emitting duplicate leave events --- ably/realtime_presence.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ably/realtime_presence.go b/ably/realtime_presence.go index e93192bd..9d6342ed 100644 --- a/ably/realtime_presence.go +++ b/ably/realtime_presence.go @@ -315,7 +315,6 @@ func (pres *RealtimePresence) processProtoPresenceMessage(msg *protocolMessage) memberUpdated := false switch presenceMember.Action { case PresenceActionEnter, PresenceActionUpdate, PresenceActionPresent: // RTP2d - delete(pres.beforeSyncMembers, memberKey) presenceMemberShallowCopy := *presenceMember presenceMemberShallowCopy.Action = PresenceActionPresent memberUpdated = pres.addPresenceMember(pres.members, memberKey, &presenceMemberShallowCopy) @@ -324,6 +323,7 @@ func (pres *RealtimePresence) processProtoPresenceMessage(msg *protocolMessage) } // RTP2g if memberUpdated { + delete(pres.beforeSyncMembers, memberKey) updatedPresenceMessages = append(updatedPresenceMessages, presenceMember) } }