mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-12 09:23:09 -06:00
Fix off by one error
This commit is contained in:
parent
11251c9762
commit
fd61776f93
|
|
@ -77,7 +77,7 @@ func (s *UserStream) Wait(ctx context.Context, waitAtPos types.StreamPosition) <
|
|||
// Icky but efficient way of filtering out the given channel
|
||||
for idx, ch := range s.waitingChannels {
|
||||
if posChannel == ch {
|
||||
lastIdx := len(s.waitingChannels)
|
||||
lastIdx := len(s.waitingChannels) - 1
|
||||
s.waitingChannels[idx] = s.waitingChannels[lastIdx]
|
||||
s.waitingChannels[lastIdx] = nil // Ensure that the channel gets GCed
|
||||
s.waitingChannels = s.waitingChannels[:lastIdx]
|
||||
|
|
|
|||
Loading…
Reference in a new issue