Skip to content

Commit

Permalink
Added extra check to avoid invoking goroutine on empty internal members
Browse files Browse the repository at this point in the history
  • Loading branch information
sacOO7 committed Nov 21, 2023
1 parent f7afecd commit ca2eed1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ably/realtime_presence.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,15 @@ func (pres *RealtimePresence) onAttach(msg *protocolMessage, isAttachWithoutMess
pres.queue.Flush() // RTP5b
// RTP17f
if isAttachWithoutMessageLoss {
internalMembers := make([]*PresenceMessage, len(pres.internalMembers))
indexCounter := 0
for _, member := range pres.internalMembers {
internalMembers[indexCounter] = member
indexCounter = indexCounter + 1
if len(pres.internalMembers) > 0 {
internalMembers := make([]*PresenceMessage, len(pres.internalMembers))
indexCounter := 0
for _, member := range pres.internalMembers {
internalMembers[indexCounter] = member
indexCounter = indexCounter + 1
}
go pres.enterMembers(internalMembers)
}
go pres.enterMembers(internalMembers)
}
}

Expand Down

0 comments on commit ca2eed1

Please sign in to comment.