Browse Source

Merge pull request #1191 from tendermint/event-buffer-slice-clearing-on-flush

types: TxEventBuffer.Flush now uses capacity preserving slice clearing idiom
pull/1200/head
Ethan Buchman 7 years ago
committed by GitHub
parent
commit
0bcc11c9bc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      types/event_buffer.go

+ 5
- 1
types/event_buffer.go View File

@ -41,6 +41,10 @@ func (b *TxEventBuffer) Flush() error {
return err
}
}
b.events = make([]EventDataTx, 0, b.capacity)
// Clear out the elements and set the length to 0
// but maintain the underlying slice's capacity.
// See Issue https://github.com/tendermint/tendermint/issues/1189
b.events = b.events[:0]
return nil
}

Loading…
Cancel
Save