Skip to content

Commit

Permalink
fixed beforesyncmembers from emitting duplicate leave events
Browse files Browse the repository at this point in the history
  • Loading branch information
sacOO7 committed Mar 26, 2024
1 parent dd8236f commit 90f705c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ably/realtime_presence.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -324,6 +323,7 @@ func (pres *RealtimePresence) processProtoPresenceMessage(msg *protocolMessage)
}
// RTP2g
if memberUpdated {
delete(pres.beforeSyncMembers, memberKey)
updatedPresenceMessages = append(updatedPresenceMessages, presenceMember)
}
}
Expand Down

0 comments on commit 90f705c

Please sign in to comment.