agent: Preserve ordering of event buffer. Fixes #479

This commit is contained in:
Ryan Uber 2014-11-20 19:51:08 -08:00
parent a9c84b9d18
commit 5badc695b8
1 changed files with 4 additions and 8 deletions

View File

@ -118,16 +118,12 @@ RUN_QUERY:
// Filter the events if necessary
if nameFilter != "" {
n := len(events)
for i := 0; i < n; i++ {
if events[i].Name == nameFilter {
continue
for i := 0; i < len(events); i++ {
if events[i].Name != nameFilter {
events = append(events[:i], events[i+1:]...)
i--
}
events[i], events[n-1] = events[n-1], nil
i--
n--
}
events = events[:n]
}
// Determine the index