assign to slice rather than append

Signed-off-by: Joni Collinge <jonathancollinge@live.com>
This commit is contained in:
Joni Collinge 2023-01-15 10:12:28 +00:00
parent c1de465e64
commit 77504a8289
No known key found for this signature in database
GPG Key ID: BF9B59005264DD95
1 changed files with 3 additions and 1 deletions

View File

@ -363,8 +363,10 @@ func (s *Subscription) RenewLocksBlocking(ctx context.Context, receiver Receiver
// Snapshot the messages to try to renew locks for.
s.mu.RLock()
msgs := make([]*azservicebus.ReceivedMessage, 0, len(s.activeMessages))
var i int
for _, m := range s.activeMessages {
msgs = append(msgs, m)
msgs[i] = m
i++
}
s.mu.RUnlock()