bqueue: simplify queue flush on Discard()

Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
Roman Khimov 2024-08-30 21:29:33 +03:00
parent 8f45d57612
commit 0fec17d7c0

View file

@ -157,9 +157,7 @@ func (bq *Queue) Discard() {
close(bq.checkBlocks)
// Technically we could bq.queue = nil, but this would cost
// another if in Run().
for i := 0; i < len(bq.queue); i++ {
bq.queue[i] = nil
}
clear(bq.queue)
bq.len = 0
bq.queueLock.Unlock()
}